publishEvent works in particle-api-js 8.0.0 but not in 8.0.1

I’m upgrading my Alexa Smarthome skill from using particle-api-js 6.4.3. I’m getting an exception calling particle.publishEvent when I upgrade to 8.0.1 or newer.

Running this code with particle-api-js 8.0.0 works without errors or exceptions.

function publish(name, data, token) {
    helper.log("publish name",name);
    helper.log("publish data",data);
    helper.log("publish token",token);
    let args = { name: name, data: data, auth: token }; // New version?
    helper.log("publish args",args);
    try {   // This shouldn't be necessary
        return particle.publishEvent(args).then(function(response){
            helper.log("publish response",response);
            let result = response.body.ok;
            return result;
        }, function (err) {
            helper.log("publish error",err);
        });
    } catch(error) {
        helper.log("publishEvent exception", error);
    }
}

On 8.0.1 or newer, I see the “publishEvent exception {}” log.
Also, in the CloudWatch logs I see this shortly after the above message:

2021-02-09T14:08:17.336Z	633e64b8-aeca-4450-83c9-449b22e84524	ERROR	Invoke Error 	
{
    "errorType": "Error",
    "errorMessage": "Main - Unknown error",
    "stack": [
        "Error: Main - Unknown error",
        "    at _homogeneousError (/var/runtime/CallbackContext.js:12:12)",
        "    at postError (/var/runtime/CallbackContext.js:29:54)",
        "    at done (/var/runtime/CallbackContext.js:56:7)",
        "    at fail (/var/runtime/CallbackContext.js:68:7)",
        "    at Object.fail (/var/runtime/CallbackContext.js:104:16)",
        "    at Object.handler (/var/task/src/main.js:74:17)",
        "    at Runtime.handler (/var/task/index.js:15:10)",
        "    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
    ]
}

I’m not sure what to do now, besides just staying at v8.0.0. Any suggestions how to proceed or debug further?

Hi @ronlisle - thanks for reporting this issue. It looks like a bug to me, but I’d like to dig in a little deeper. Would you mind opening a support ticket (support.particle.io) with a bit more information (describing the entire flow)? We’ll update this thread once we have come to a conclusion!