Axios post request and other node modules that send api requests work locally and on github server, but not on Vercel #68283
-
SummaryI have tried to send a post request from my next.js app and the request works both locally and when deployed on github server when running a github action, but that same request does not work when deployed to vercel. When I say it doesn't work I don't get a 401 or a 404 or any status errors. It simply appears to not even execute the request - I try to print logs using console.log, but nothing is being logged within the request. Here is a snippet of code I've tried (works locally, doesn't work on vercel) ` const agent = new https.Agent({ Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey ! Same problem here, did you find a solution ? |
Beta Was this translation helpful? Give feedback.
Yea what I did was create a separate function that returned a promise. And then I awaited that function.
The way vercel handles serverless functions caused it to skip the callback, so explicitly wrapping the request in something like:
return new Promise((resolve, reject) => {
worked for me