Payload Parser Troubleshooting

Payload Parser Troubleshooting

When using the Payload Parser on TagoIO, you might run into some common problems that stop the parser from decoding your device data correctly. This means the data won't be saved on TagoIO. These problems are usually related to mistakes in how the payload parser code is written, but they can be fixed easily.

For updates on our system's status, visit our health status page at https://status.tago.io/.

Common Issues:

1. Function Parse Error: Payload Parser Terminated Unexpectedly

This issue happens when the Payload Parser stops working because it runs into an error in the code that's not formatted correctly. For instance, if you've written an error message in your code like throw "my error message", it can cause the parser to stop unexpectedly.

To fix this, make sure you're using the right format for error messages in JavaScript, which is what the Payload Parser uses. You should create an error using the 'Error' class like this:
  1. throw new Error("my correct error message");
This method of creating an error gives you a clear and detailed error message, making it easier to understand and fix the problem in your code.

2. "your_variable" is Not Defined

This error pops up when the Payload Parser tries to use a variable that hasn't been set up correctly. For example, if you write temp = payload.value without defining what 'temp' is, you'll see the not defined error.

To prevent this, always declare your variables with const, let, or var before you use them. This not only stops reference errors but also makes sure your code follows best practices for managing variables in JavaScript. Here's some ways you should declare a variable:

Example 1:
const temp = payload.value; 

Example 2:
let temp = payload.value; 

Example 3:
var temp = payload.value; 

By following these guidelines, you can avoid common errors and make sure your Payload Parser code works smoothly.
Still need help? Contact our support team through the Help Center page.

    • Related Articles

    • Payload Parser - Context & global variables

      If you are going to create your own parser, you need to understand how context works. When you start writing your own Payload Parser, you can use certain globals variables in your code. Think of these global variables as variables that you can access ...
    • Payload Parser

      The Payload Parser handles the raw payload sent by the devices in order to extract the measured variables. For example, it can be used to transform an HEX payload sent by a device into temperature and battery levels. You can also use it to handle the ...
    • Creating a Network integration

      To create a new integration you must go to the Network management page and press the following buttonon the right side of the page. You only need to specify the network's name. Once you have the network created, you have several parameters that you ...
    • Connecting your MQTT Broker to TagoIO

      TagoIO supports MQTT connections through our MQTT Relay command-line tool. This software acts as a bridge between your MQTT Broker and the TagoIO platform, facilitating seamless integration and data flow. Developed in Rust, the TagoIO MQTT Relay is ...
    • Building your own parser

      In this tutorial, you will learn how to convert (parse) a raw payload sent by a device into actual measurable variables.  Data flow structure You can create parses for devices that weren't found in our list of Devices, so that you had to use a ...