03-17-2020 02:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-17-2020 02:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi! I am trying to POST data from companion to my Django server.
fetch('https://172.25.96.56:8000/hello/', {
method:'post',
headers: {
'Content-Type': 'application/json'
},
body:JSON.stringify(evt.data)
}).then(res => res)
.then(response => console.log('Success:', response))
.catch(error => console.error('Error:', error));
The result is always TypeError: Failed to fetch
My Django server has already been running over https and I can POST data through another Python program but failed on the companion...Why would this happen? Thank you!

- Labels:
-
JavaScript
03-17-2020 12:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


03-17-2020 12:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
App permission would be a quick thing to check.
Your server may need CORS. I forget the details.
Gondwana Software

03-17-2020 18:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-17-2020 18:48
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I have already given permission to this app also set CORS on my server.😭
I saw some other topic they said they use this way it works...I just don't know why this didn't work on my app. 😭

04-21-2020 21:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-21-2020 21:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I think I am running into this same issue. Was trying to test using the SendMessage app to POST data to my home automation server. . .but it isn't getting there. I tested with the "Httper" app on my same device (where the fitbit is paired) and it successfully delivers the POST action. . .the app has permission and it will post to a server on the internet, but not one that I am trying to reach using the IP of my LAN.

04-21-2020 22:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-21-2020 22:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Are you running https (not http) on your server?
Gondwana Software

04-21-2020 22:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-21-2020 22:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
No. Local server is running http and accepts internal requests only.

04-21-2020 23:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-21-2020 23:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I think that's the issue then. You can only use http with 127.0.0.1 in your companion.
Gondwana Software

