Thing.get() returns null instead of number 0?

Wanted confirmation that this is a bug.

I have a list of Things that I am trying to fetch in a Server Script using Thing.get(). It seems that when the Thing’s Order Num (a Number) Field contains a zero value, the .get() method returns null instead.

This behaviour seems isolated to Number fields, as the string “0” returns correctly, but the number 0 returns null.

Assuming you are using server side actions with plugin version 4 bubbleThing.get(prop) returns a Promise.
https://manual.bubble.io/account-and-marketplace/building-plugins/updating-to-plugin-api-v4#change-log

Yes, and how does a Promise affect whether the response returns a null when it should return 0?

As you can see in my screenshots, I have no issue printing orderNumber for the Thing titled “my title” using await Thing.get("orderNumber"). So I fail to understand the relevance of your point.

You didn’t share your code, so I was just reminding that you need to handle the Promise.
Without the code you can only get some wild guess because only you know what you are doing.
If you are 100% sure that is a bug you should file a bug report. I did it in the past when I found bugs in the plugin api. If you create a clean test plugin with only an action with minimal code, and a clean app with only a page clearly reproducing the code the request get escalated quickly, and it’s also a good way to check yourself if it’s a bug.

I tried it myself. It looks like it is indeed a bug. You should go on and send a bug report.

Thanks for confirming.
I just opened the Bug Reporting form. That’s way too much effort for me. Feel free to report it.

Current workaround to the “Number 0 to Null” issue is to replace all Number fields with String fields, and casting to Numbers when needed. The String 0 returns correctly using Thing.get(prop). String versions of digits seem to sort correctly too, so need to cast to number when sorting.

I’ve had to use “number + 0” before. Maybe this would work for you, since you’re dealing with a number vs. string?

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