API not working when list item is empty


I’ve created a backend API with one of the parameters ‘jobs_country’ as an Optional List of Things.

However when I try and post to the API without passing data into jobs_country I receive the following error:

“Invalid data for key module:jobs_country expecting an array, but this is a undefined”

I’m confused as I’ve definitely set the parameter as optional so I should be able to pass an undefined parameter into the API? This issue only occurs when the parameter is defined as alist of things, when I remove ‘list’ from the parameter it works, I’m able to run the API with an undefined ‘jobs_country’

Any help much appreciated.

That actually sounds like a bug. (Bug report form here: https://bubble.io/bug_report .)

One way you could test this further/work around it would be to pass your backend workflow a zero-item list of jobs_country type.

(The way to create such an object is to “Do a Search for…” items with that data type with an impossible condition, such as “Created at date is greater than Current date/time” <-- those would be objects from the future, see?

This is, in essence, what Bubble should be coming up with rather than interpreting the field as undefined, if you’ve indeed set your workflows inputs correctly.)

This topic was automatically closed after 70 days. New replies are no longer allowed.