Application Live Data: Fail to connect to MQTT

In the TTN console, one of my applications is not showing any Live Data from a specific device, even though the device was working before a day ago.

The message in the console I see is:
Fail to connect to MQTT
API key not found: Api key with id QFSASO476xxxxxxx…etc not found.

I already removed the MQTT API key and generated a new one, but the above message keeps coming up, even after I completely removed the MQTT integration.

Is this cached somewhere?

I am also experiencing the same problem. The TTS console live data stream keeps showing Fail to connect to MQTT API key not found.

Did you change your APi key?

Then where ever you integrate too, you need to update the API key there as well.

So where ever your MQTT broke is, you need to change it there as well.

You local applications is not going to know magical that it were changed.

1 Like

Thank you for your response, I have indeed changed the API key and now even removed it, but then I find it strange that I do not even see Live Data in the device console when I activate the node … after all, no integration needs to be set up to see the node’s data in the console?

Let me mention the steps I just performed:

  • created an API key in the console
  • API key copied
  • In node-RED MQTT node, Username(…@ttn) and Password(APIKey) copied
  • Flow deployed and node-RED MQTT node shows status “connected”
  • The device activated and status checked on the gateway

…but still no data visible in:

  • node-RED Debug tab
  • TTN Console > Device > Live Data

…but still no data visible in:

  • node-RED Debug tab
  • TTN Console > Device > Live Data

TTN Console Application > Live Data still says:
Fail to connect to MQTT API key not found: Api key with id KU4AMVR…etc not found

You are correct and it may simplify your troubleshooting if you separate out the two issues of device no data and MQTT connection not working.

If you are using the API key id, that’s not the string you are looking for - each key comes with an id - you may want to look again at the dialog box that comes up and perhaps look at the docs. All the keys start NNSXS.

The id is so we can reference it in the API’s as the key is only provided one time and then hashed.

It also helps to use a standard MQTT client to test / debug the connection - I use MQTT Explorer.

I will first go and check under the ‘Configuration Nodes’ in Node-red and delete the mqtt-broker.

I will then re-create the mqtt-broker with the new API (NNSXS.ZIM744S********************************.***********************************xxxxxxxxxxxxxxxxx) and user name xxxxxx@ttn, once deployed this will take a few seconds to connect.

As far as your nodes are concerned.
Can you see the uplinks in the gateway console?
Are your gateway online?
How long have you nodes been running?
Are the battery good?

These are two different issues that hopefully coincidently occurred at the same time.

Thanks Johan and Nick, the problem is now solved. Apparently the process of deleting and re-creating an integration API didn’t work out as it should.

I have looked at both problems separately and since my device is functioning correctly, I have performed the following steps:

  • Created a new application
  • In this new application, re-register the existing devices (which were still linked to the old application).
    A number of important keys can be easily copied in this way
  • Activated my device and checked whether data is visible in the new application.
  • Generated an API key for the MQTT integration in the new application.
  • Changed the Username and password in node-RED > Securitytab MQTT node.
  • Changed in node-RED MQTT node > Properties, the Topic application id and @ttn
  • Activated my device and checked the node-RED Debug pane for data
  • Payload function copied from old application to new one.
  • Registered devices under old application removed
  • Removed old application

Everything is working fine now :+1:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.