Function call failed: Server error

Hi Particle,

I am calling an IoT function to return some value but I’m getting “Function call failed: Server error” problem.

I was using particle cli version 1.30.x and I just updated to 1.31.0 but I am still getting this problem. I tried on an old computer with 1.23.0 and it worked fine.

Thank you very much!

Honestly, I just want know how could I downgrade at this stage because I am experiencing other issues every time I updates to a new version. Any way I can do that? Currently my most favorite version is 1.21.0.

Thank you!

There should not be any benefit in using an old CLI.

What exactly did you do that failed?
How does the called function look in your firmware?
It’s just a guess, but it may be that the older CLI used a slightly longer timeout for a Particle.function() call to return, but since a Particle.function() handler should usually return in less than a second the possible difference in timeout should not play any role.

I am trying to take a sensor reading in that function call and it has i2c communications in it. Yes It might take a while to get the return value.

Does it have anything to do with the parameter string the function takes? Here is what I’m experiencing:
particle call PARTICLE_ID dbg sensor_reading
=> server error
particle call PARTICLE_ID dbg status
=> 1 (which means fine.)

So is the underscore not acceptable?

That’s probably the issue.
The underscore in the command payload shouldn’t play any role.

I guess dbg status returns a lot quicker than dbg sensor_reading does.

I previously have proposed an option to mark a Particle.function() as “slow returning” having the cloud extend the timeout period for it (e.g. by providing a timeout parameter for the expected time it would usually take), but that hasn’t been considered by Particle yet.

Till then (if ever) I have my functions only set a flag and return immediately.
The flag tells loop() to perform the action and set a Particle.variable() to “return” the result.

New input! I found that whenever a 0 value is returned, I got this server error. For example, my sensor reading function returns something non-zero, I can get it right.

I am wondering if Particle is using 0 as their error code for server error??

That shouldn’t be, but I’ve just tested and you seem to be right - I think that’s not intended.

Have you tried console.particle.io/devices to trigger your function?

Yes I was going to but because we have a lot of units online and there is no filtering or searching function on the /device page, it was hard for me to find my testing device.