You may encounter errors while creating your automation with Meta API: that’s part of any coding activities (yes, you’re a coder when you use Meta API!) and that’s okay.
Let's review the most common errors and how you can fix them.
Something goes wrong with data format
If you try to manipulate a number as a string, it’s like putting a square peg in a round hole: that’ll crash at some point or create an unexpected behavior.
Check your data and see if it’s the right type. It’s common to see numbers return as a string by APIs for example.
Example in Stripe’s API where a number is return both as a number and a string
If you need to transform the data format, you have many functions to do this (like parseInt() to transform a string to an integer). Check the MDN documentation to have all existing functions.
Error with a connector (and an API)
APIs can be wild! Even if they respond to the same “standardization”, every developer implements them in their own way.
The first thing to do is to check the HTTP error to identify what is the cause of the error. Here some examples:
- 401 : you have an authentication error. Check your API key or your credentials
- 403: you have a forbidden error. That mean that your API key or credentials are good, but you can’t access this resource. Maybe you don’t have enough permissions or need an upper role.
- 404: not found (the most known error!). You want to access an unknown resource. Check the ID, mostly inside the parameters.
- 400: bad request error. The data you send aren’t well formatted. Check this part “Something goes wrong with data format” to know how to format data.
- 500: internal server error. It’s a generic error, so you must check the error message associated with the HTTP error code. You don’t find anything, ask the API provider support or community with the debug informations.
You already have an integration inside Meta API of help messages based on HTTP error code. Check then inside the console to know what you have to do to fix it.
Error with some JS code
First, look for syntax errors and check if you have missed a character or miss typed an object property.
If you didn’t solve it, try to type the function you try to achieve or make on search on platform like StackOverflow to see examples.
You can also use MDN docs to check the methods you want to use.
I can’t access the data I want
The first thing to check is you source endpoint: will this endpoint give you all the data you want?
Check the response schema or the original documentation to verify if you’ll find the data you want.
Then, see inside the debugger if you find the data you want.
If you want to extract and transform data, you can use the Function block to achieve this
Tips for debugging
Debugging is now integrated inside Lumo, our low-code interface. You can check data coming from any block to verify if you try to access unavailable data or to have the original format.
Inside our code editor (or a Function Block) : you can use the
console.log() function to log an object or a value inside the Console panel.