Issue with particle-api-js flashDevice

I am attempting to use particle-api-js and am running into an issue with flashDevice. Here is the basics of what I am calling:

var Particle = require(‘particle-api-js’);
particle = new Particle();

particle.flashDevice({ deviceId: DEVICE_NAME_HERE, files: {file1: ‘./file1.bin’}, auth: ACCESS_TOKEN_HERE }).then(function(data) {
console.log(‘Device flashing started successfully:’, data);
}, function(err) {
console.log(‘An error occurred while flashing the device:’, err);

However, not matter how I try to hand in the files list, I get back:

Device flashing started successfully: { body: { error: ‘Nothing to do?’ }, statusCode: 200 }

Any thoughts?

Which version of particle-api-js are you using?

1 Like

5.2.6. Other commands seem to work fine, just anything with a file involved doesn’t seem to work. I tried the Compile command as well, same issue.

Can you try using an absolute path to your file?

i have. i create the list myself and output it, it looks like this: { file1: ‘/Users/eely/workspace/bluzDK/’ }

i have tried changing the name of the file (from file1 to file, to the actual name of the file tinker, etc). i have given absolute path, relative path. no matter what i try, it always seems to come back with Nothing to Do

I just published 5.2.7, can you give that a shot?

Yup, that fixed it. Thanks!

1 Like

Great! Sorry for the trouble.

1 Like

One more question. If I send multiple files, I am not seeing both applied. So if I have two files in the list for the command, I would expect the first to go through, the device reboots, comes back online, and then the second would go through. But I only see the first file go through. The device comes back online and the second file is not flashed

This is on bluz, not on a Photon, so is the sequence we are using different? Should I not be rebooting in between? How does it normally work?

The API does not support sending multiple files right now.

Understood. Is there a timeline to add that?

The docs indicate it is possible, so you may want to update that accordingly until it is supported. It lists it in both:


Is this a limitation of the JS or is it a limitation on the cloud side? If it is the JS side, I can try and modify and issue a PR. I didn’t look too closely, but from what I saw it looked like maybe it was a cloud side restriction?

It is a cloud-side restriction on flashing. Compiling works with multiple files. I will update the docs to be accurate. Thanks for pointing this out.