Function seeing axios.post as GET request

I tried updating to that format and testing locally and still only seem to get a GET which is bizarre…

await axios({
  method: 'post',
  url: 'https://tweet-with-twitter.netlify.com/.netlify/functions/tweet',
  data: payload,
  headers: {
    'Authorization': token
  }
});

I did however try to POST with fetch just to test and it seems to go through as a POST but just having trouble getting the formatting to take in the payload right :thinking: so maybe it’s an issue between axios and the serverless framework which i’m using for the app?

The strange thing is that it works on my locally served netlify function (localhost:9000) but not when posting directly there.

await axios({
  method: 'post',
  url: 'http://localhost:9000/tweet',
  // url: 'https://tweet-with-twitter.netlify.com/.netlify/functions/tweet',
  data: JSON.stringify(payload),
  headers: {
    'Authorization': token
  }
});

Anyways, I’ll either use a different tool or keep digging.

Thanks

1 Like