Invalid Token error trying to instantiate a Device

I am trying to run an Analysis in development mode, trying to instantiate a Device object.
This is working for one of the devices (custom HTTP), however not on another (this is a TTN device).

Are there any permission issues or any other device characteristics that could cause this? The device was created by someone else.

try {
theDevice = new Device({“token”: “0b80f823-9c3a-4dc5-a36e-2ced0fada0d6”});
theDevice = new Device(token);
context.log(“device created”);
} catch (e) {
context.log("error: " + e);

Hi, @sanimesa

Can you share the entire code?

It seems that you are trying to use a undeclared variable.