Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.
0

ESP8266 Sketch failure
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

ESP8266 Sketch failure

by ron_g on Wed Jan 06, 2016 10:42 am

I'm trying to run the ESP8266 example (Arduino) sketch and it is not working. I turned on debugging the it is failing in the POST and displays this message:
HTTP POST failed with error code: 500

Generally a 500 indicates a problem on the server side. I did create a "esptestfeed" feed on my dashboard so I believe it should work. Is there a problem with the server? I've tried it several times over the past few days and am consistently getting this error.

Thanks.

ron_g
 
Posts: 156
Joined: Tue Apr 05, 2011 6:21 pm

Re: ESP8266 Sketch failure

by ron_g on Wed Jan 06, 2016 8:05 pm

I figure I am doing something wrong but not sure what. It isn't my AIO_KEY in error as if I change one digit in that I get a different error on both POST and GET
HTTP GET failed with error code: 403

Like you I'm using IDE 1.6.5. I downloaded the AIO library less than 2 weeks ago so I imagine it is current. I also tried changing the feed name to one that didn't exist and that gets the same error as I posted above on the POST (500).

Only thing I can think to do is try to post data from Python or something other than Arduino and see if it works from there. Otherwise I wonder if my ID/account might have a config error on the server side, given I get a 500.

ron_g
 
Posts: 156
Joined: Tue Apr 05, 2011 6:21 pm

Re: ESP8266 Sketch failure

by ron_g on Wed Jan 06, 2016 8:16 pm

I just did a post of data using my key using a browser and that worked fine, darn it. It created the feeds and returned success. Darn it. Going to have to give more thought to how to figure out what's wrong. Possibly hack the library to output the details of what it is sending.

ron_g
 
Posts: 156
Joined: Tue Apr 05, 2011 6:21 pm

Re: ESP8266 Sketch failure

by ron_g on Wed Jan 06, 2016 8:53 pm

Thanks for posting that. I used one of the curl examples to try to post data and it failed with a 500 as well. Below is the curl command and response (I replaced my actual AIO key with "AIOKEY". I tried both a non-existent feed name "somenewfeedname" as well as one I created in advance.
Code: Select all | TOGGLE FULL SIZE
curl -H "Content-Type: application/json" -X POST -d "{\"value\":\"456\"}" -H "x-aio-key: AIOKEY" http://io.adafruit.com/api/feeds/somenewfeedname/data/send.json
500 Internal Server Error
If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.


I noticed in the browser example on the Adafruit site it includes a 'group'. Is that required for the Arduino code to work? Note the key in the example I posted below is the one they include in their example, not mine. When I tested using my browser I replaced it with my key (which worked).
Code: Select all | TOGGLE FULL SIZE
https://io.adafruit.com/api/groups/weather/send.json?x-aio-key=a052ecc32b2de1c80abc03bd471acd1d6b218e5c&temperature=13&humidity=12&wind=45

ron_g
 
Posts: 156
Joined: Tue Apr 05, 2011 6:21 pm

Re: ESP8266 Sketch failure

by ron_g on Sun Jan 17, 2016 11:09 am

In case anyone else has a problem like this (HTTP 500 response), I couldn't find anything that would work with my beta account

The solution was to use Settings to delete my data and my account and then re-sign up for the beta. Since doing that everything works as expected.

ron_g
 
Posts: 156
Joined: Tue Apr 05, 2011 6:21 pm

Re: ESP8266 Sketch failure

by sellensr on Sat Jan 23, 2016 9:08 pm

@roadfun, I just replicated your experience, including the part where destroying the account and starting fresh fixed the problem. The second time, the system created a different welcome dashboard -- it had a slider and a gauge on it that didn't exist the previous time.

On the first round I created a collection of feeds through the web interface, then tried to get response through my ESP8266. I seemed to get a successful link, but with a response indicating no feeds exist, yet the feeds were visible through browser queries.

Requesting URL:
GET /api/feeds?X-AIO-Key=860[a bunch of key redacted]0e8 HTTP/1.1
Host: io.adafruit.com
Connection: close

Response:
... HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
X-XSS-Protection: 1; mode=block
X-Request-Id: 44201be8-95bd-4828-9b8e-92fe7aa2e043
ETag: W/"58e0494c51d30eb3494f7c9198986bb9"
X-Frame-Options: SAMEORIGIN
X-Runtime: 0.022935
X-Content-Type-Options: nosniff
Date: Sat, 23 Jan 2016 23:25:12 GMT
X-Powered-By: Phusion Passenger 5.0.22
Server: nginx + Phusion Passenger 5.0.22
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET
Access-Control-Allow-Headers: DNT,X-AIO-Key,Accept,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type

3
[shouldn't the feed descriptors be inside these square brackets?]

0

sellensr
 
Posts: 47
Joined: Tue Nov 06, 2012 9:41 pm

Please be positive and constructive with your questions and comments.