Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error connecting to particle cloud #68

Open
karmakazi opened this issue Oct 30, 2015 · 9 comments
Open

Error connecting to particle cloud #68

karmakazi opened this issue Oct 30, 2015 · 9 comments

Comments

@karmakazi
Copy link

I'm using a photon.

This is the error:

Error: Unable to connect to particle cloud.: code: 404 undefined
at IncomingMessage. (/Volumes/Lychee/Users/andrewh/Development/node/node_modules/particle-io/lib/particle.js:346:19)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:919:16
at process._tickCallback (node.js:419:13)

I'm using your sample code:

var Particle = require("particle-io");
console.log("Token = " + process.env.PARTICLE_TOKEN);
console.log("Device ID = " + process.env.PARTICLE_DEVICE_ID);

var board = new Particle({
token: process.env.PARTICLE_TOKEN,
deviceId: process.env.PARTICLE_DEVICE_ID
});

board.on("ready", function() {
console.log("CONNECTED");
this.pinMode("D7", this.MODES.OUTPUT);

var byte = 0;

// This will "blink" the on board led
setInterval(function() {
this.digitalWrite("D7", (byte ^= 1));
}.bind(this), 500);
});

Any ideas?

@tjhenry
Copy link

tjhenry commented Nov 11, 2015

I get the same thing. When putting log output in particle.js it is connecting to https://api.particle.io/v1/devices/<my_device>/endpoint?access_token=<my_token>

This returns JSON, but the response code is 404. The response is
{ "ok": false, "error": "Variable not found" }

@rwaldron
Copy link
Owner

Hi! Sorry for the delay in responding. Can either of you report back which version of VoodooSpark is flashed to the board?

@littulb
Copy link

littulb commented Dec 1, 2015

I'm having that same issue. I'm working with VoodooSpark version V3.1.2

@rwaldron
Copy link
Owner

rwaldron commented Dec 1, 2015

Run the following and post the response:

curl https://api.particle.io/v1/devices/{DEVICE-ID}/endpoint?access_token={ACCESS-TOKEN}

This is what mine looks like:

{
  "cmd": "VarReturn",
  "name": "endpoint",
  "result": "192.168.1.6:48879",
  "coreInfo": {
    "last_app": "",
    "last_heard": "2015-12-01T23:19:49.469Z",
    "connected": true,
    "last_handshake_at": "2015-12-01T23:19:42.577Z",
    "deviceID": "31002e000347343337373739",
    "product_id": 6
  }
}

@littulb
Copy link

littulb commented Dec 1, 2015

mine returned

{
"ok": false,
"error": "Variable not found"
}

@littulb
Copy link

littulb commented Dec 1, 2015

I did.... the response I received was...

{
"ok": false,
"error": "Variable not found"
}

On Tue, Dec 1, 2015 at 5:17 PM Rick Waldron [email protected]
wrote:

Run the following and post the response:

curl https://api.particle.io/v1/devices/{DEVICE-ID}/endpoint?access_token={ACCESS-TOKEN}


Reply to this email directly or view it on GitHub
#68 (comment)
.

@rwaldron
Copy link
Owner

rwaldron commented Dec 2, 2015

Thanks. That error is shown when something other than VoodooSpark is flashed to the board. Take a look:

(the photon initially has voodoospark flashed)

$ curl https://api.particle.io/v1/devices/{REMOVED}/endpoint?access_token={REMOVED}
{
  "cmd": "VarReturn",
  "name": "endpoint",
  "result": "192.168.1.6:48879",
  "coreInfo": {
    "last_app": "",
    "last_heard": "2015-12-02T15:45:09.820Z",
    "connected": true,
    "last_handshake_at": "2015-12-02T15:43:47.215Z",
    "deviceID": "{REMOVED}",
    "product_id": 6
  }
}

So then I flashed the tinker firmware:

rwaldron at nova in ~
$ particle flash --usb tinker
Found DFU device 2b04:d006
checking file  /usr/local/lib/node_modules/particle-cli/binaries/photon_tinker.bin
spawning dfu-util -d 2b04:d006 -a 0 -i 0 -s 0x080A0000:leave -D /usr/local/lib/node_modules/particle-cli/binaries/photon_tinker.bin
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to [email protected]

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x080a0000, size = 3952
Download  [=========================] 100%         3952 bytes
Download done.
File downloaded successfully

Flash success!

And try hitting endpoint again:

rwaldron at nova in ~
$ curl https://api.particle.io/v1/devices/{REMOVED}/endpoint?access_token={REMOVED}
{
  "ok": false,
  "error": "Variable not found"
}

Re-flash with voospark:

rwaldron at nova in ~
$ particle flash --usb voodoo
Found DFU device 2b04:d006
checking file  /usr/local/lib/node_modules/particle-cli/binaries/voodoospark.bin
spawning dfu-util -d 2b04:d006 -a 0 -i 0 -s 0x080A0000:leave -D /usr/local/lib/node_modules/particle-cli/binaries/voodoospark.bin
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to [email protected]

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Deducing device DFU version from functional descriptor length
Opening DFU capable USB device...
ID 2b04:d006
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 4096
DfuSe interface name: "Internal Flash   "
Downloading to address = 0x080a0000, size = 86704
Download  [=========================] 100%        86704 bytes
Download done.
File downloaded successfully

Flash success!

And the endpoint is restored:

rwaldron at nova in ~
$ curl https://api.particle.io/v1/devices/{REMOVED}/endpoint?access_token={REMOVED}
{
  "cmd": "VarReturn",
  "name": "endpoint",
  "result": "192.168.1.6:48879",
  "coreInfo": {
    "last_app": "",
    "last_heard": "2015-12-02T15:50:23.042Z",
    "connected": true,
    "last_handshake_at": "2015-12-02T15:50:16.893Z",
    "deviceID": "{REMOVED}",
    "product_id": 6
  }
}

The reason is that endpoint is defined by VoodooSpark: https://github.com/voodootikigod/voodoospark/blob/master/firmware/voodoospark.cpp#L284

@littulb
Copy link

littulb commented Dec 2, 2015

rwaldron: I kept getting the error still after re-flashing. Then I re-flashed while in Safe Mode and that worked. You were right. But for some reason it would not apply the updated firmware without putting it in Safe Mode first.

Good deal!!!

@rwaldron
Copy link
Owner

rwaldron commented Dec 2, 2015

Whoa, weird—hopefully this helps the other reports above! Thanks for the follow up @littulb!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants