Tutorial: Local Cloud 1st Time instructions [01 Oct 15]


Then I used spark setup to connect to the local cloud, everything goes well and it claims the core, but when I do

spark list

local-cloud (53ff6e066667574831421267) is offline

So I checked the node js server

It shows the error: - - [Sat, 24 Jan 2015 17:37:04 GMT] “POST /oauth/token HTTP/1.1” 200 115 “-” "-"
ListDevices { userID: ‘7ffBA7Bn9IzW8rxO8UbaIrwtFpDbiDPO’ }
Couldn’t find that core 53ff6e066667574831421267
isDeviceOnline: Pinging core… { coreID: ‘53ff6e066667574831421267’ }
Couldn’t find that core 53ff6e066667574831421267
ListDevices… waiting for connected state to settle { userID: ‘7ffBA7Bn9IzW8rxO8UbaIrwtFpDbiDPO’ } - - [Sat, 24 Jan 2015 17:37:16 GMT] “GET /v1/devices?access_token=3c55d5dec5b754244c31eab766f0c0cbcef999c4 HTTP/1.1” 200 123 “-” "-"
Potentially unhandled rejection [1] send failed (WARNING: non-Error used)
isDeviceOnline: Ping timed out { coreID: ‘53ff6e066667574831421267’ }

Seems like it’s still not connected. Is there something wrong with wifi?


What’s the colour of the RGB led for the core? It should be breathing cyan.


It’s now flashing yellow and has the error:

CryptoStream transform error TypeError: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
onSocketData called, but no data sent.


You might want to try flashing the server key again. There seems to be some error and the core should be breathing cyan as per normal.

Seems like you are not familiar with the normal setup yet… Might want to play around with the core and understand how things are working before playing with the local :cloud:? :wink:


Thank you so much for help @kennethlimcp, I solved the problem, and the core is able to connect local cloud and easily switch to the spark cloud. However, when the core is connecting to the spark cloud, I ran

url https://api.spark.io/v1/devices/53ff6e066667574831421267/digitalWrite -d access_token=6e4d08ced729a0842265ba0a49bff783947db5c0 -d params=D7,LOW

It works fine. But locally, when I run the same url, but change the access_token to the local one, it shows the error:

curl: (35) Server aborted the SSL handshake

When the core connects to the local cloud, it was breathing cyan, which is the same when it connects to the spark cloud.



the url should change to your own :cloud: settings as well. Example: and so on

The setup is on HTTP and HTTPs which explains the reason for the failure


Can I use the sparkjs for the local cloud? I saw the source code, do I just need change the base_url from https://api.spark.io to my local url?



the quick answer should be yes since the local :cloud: is like the spark :cloud: but stripped down to the basic functionalities.

I haven’t tested it before but would be happy to hear the progress you make! :loudspeaker: if you need more help and i’ll jump in to help :wink:



I’ve been trying to get the local cloud working again after a change of computer. I can get the local cloud server up and running and connecting to the core which is breathing cyan happily. The problem I have is setting up the account and getting a token so I can access the core with curl. I have tried to access the connected core with/without an access token, but it doesn’t matter what I try everything comes back with invalid token…

Whenever I try setup it comes back with this:

 login error:  [Error: Invalid protocol:] 
 Error logging in Login Failed: Error: Invalid protocol:

I try it with the server running and not running. So I never seem to be able to create an account! Each time the server starts it comes up with the message:

"No users exist, you should create some users!"

Easier said than done.

Without an account you cannot get a token, and no token: no access, so how do I create an account and get a token I can use to access the core given the situation I’m in?

My local cloud server identifies with two cores, but it seems it does not recognize any accounts, and I cannot find any reference other than “null” to any tokens in the config files.

Many thanks,


I presume are using spark setup to create a new account?

Can you also check using spark config identify and make sure that the server ip address doesn’t contain https://?

New account creation works like a normal new user registration you see for websites. There is no need for an access token to create new accounts.

You might want to understand the spark ecosystem and study it further to know things fit together :wink:


the ip address is simply

where can I read about the spark ecosystem?

Thanks, Kenneth.


so my question is did you use spark setup and created a new account?


Apologies, yes I used spark setup as per your tutorial. Is there somewhere the spark ecosystem is described so I can understand it better (without needing a phd!)?


Seems like you didn’t follow the tutorial closely.

Please paste the output of your spark config identify here :wink:


I deleted everything and re-installed the server, ran it once and then began this tutorial. Here’s a screen shot of what I did. To be clear the server was NOT running when I did all this. It’s not clear from the tutorial whether it should be.

Note that after I entered the "spark config ks1 “” the config had not switched to ks1, so I did this manually before executing spark startup.

I would very much like to read about the ecosystem, so if you could point me to something that describes it, I’d be most grateful. I’ve looked around, but cannot find anything.



The instructions said spark config profile_name apiUrl "http://DOMAIN_OR_IP"

So your http:// is missing and that explains the issue.

As a matter of fact…the script should be running in order to connect…


Ooops. That wasn’t too clever of me. Many thanks, Kenneth.
Can you recommend any reading on the ecosystem?
All the best,


I’m trying to setup a local cloud running spark-server on a raspberry pi following the tutorial. The server is running and giving me a public key. I’ve also generated a local profile that holds the settings for my local cloud:
Current profile: local
Using API:

I’ve used spark keys send to transfer the core keys to the server and copied the server public keys to my core using

spark keys server default_key.pub.pem IP_ADDRESS

I registered a new user on my local cloud using spark setup
After reset the core connects (flashing green, then breathing cyan) but I get the following output from the server:

Connection from:, connId: 2
CryptoStream transform error TypeError: Cannot read property ‘length’ of null
CryptoStream transform error TypeError: Cannot read property ‘length’ of null
on ready { coreID: ‘<my_core_id>’,
ip: ‘’,
product_id: 65535,
firmware_version: 65535,
cache_key: ‘_1’ }
Core online!
CryptoStream transform error Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt

After a few seconds the core flashes cyan faster and tries to connect again resulting in the same server output (connection id increments)

I checked my raspberry installation and the only obvious difference I could find was the version of the node.js module (0.12.0) instead of 0.10.29 as in the tutorial.
I’m doing all interaction with my local cloud and the core from a Windows PC.

Any idea?


Don’t think that should affect but maybe you can try to rollback the nodejs just to test?


Reinstalled Rasbian (rollback was not possible/failed), installed node 0.10.36 (couldn’t find 0.10.29 for the Pi) and now everything is working. I’m not sure if this was really the version rollback, might have also been the Rasbian re-install…
BTW: I had no problems with the usra and express modules as indicated in your docs.
I also made the Windows local cloud work.

There’s another thing I noticed though: I can only subscribe to all events (GET /v1/events) or named events (GET /v1/events/:event_name) but not to core specific events. This was indicated in another thread already, but it was not 100% clear to me which event subscriptions work.