11-20-2019 03:12
11-20-2019 03:12
Hello fellow Fitbit developers,
I have developed an app that get the heart rate from a fitbit ionic device and sends it to the android companion. The companion is connected to a hotspot created by my laptop, which hosts a local Flask server.
When trying to POST the data from the companion to the Flask server, I get this error message
```
TypeError: Failed to fetch
```
The weird thing is that I can perform POST from a terminal I have installed in my phone, but the companion cannot perform the request itself. This is my code for fetch:
Do you have any idea what is going on?
Answered! Go to the Best Answer.
Best Answer11-20-2019 22:16
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-20-2019 22:16
While you're supposed to be able to use http for localhost, I think that's currently broken (it wants https in all cases(!)).
I think this is a known issue; a fix has been promised.
Best Answer11-20-2019 22:02 - edited 11-20-2019 22:15
Fitbit Product Experts Alumni are retired members of the Fitbit Product Expert Program. Learn more
11-20-2019 22:02 - edited 11-20-2019 22:15
Hi @OrestisZekai,
I think your thread may find a better home, rather than where it was originally posted in the general Ionic customer support forum. We have two dev forums, one for the SDK and one for the Web API. From your code snippet, it looks like the Web API forum may be the place for it, so I'll move it there. If I'm incorrect, just let me know here and I can place it in the SDK forum..
Best Answer11-20-2019 22:16
Gold Fitbit Product Experts share support knowledge on the forums and advocate for the betterment of Fitbit products and services. Learn more
11-20-2019 22:16
While you're supposed to be able to use http for localhost, I think that's currently broken (it wants https in all cases(!)).
I think this is a known issue; a fix has been promised.
Best Answer11-21-2019 02:51
11-21-2019 02:51
Hello @Gondwana,
looks like you are correct. I set up the same Flask server in a secure webserver over https and I can finally get messages through.
But I really hoped I would be able to do it all in my hotspot. Thanks anyway
Best Answer