0

So I was trying to host a serverless function today. First I tried Vercel, /api/index.js And it was working fine in dev but as soon as I deployed it it started sending the code in response instead of executing the file and sending response as stated in it.

So now I'm trying Netlify but no luck here either. /functions/tweet.js the response

  • Please provide enough code so others can better understand or reproduce the problem. – Community Jun 24 '22 at 15:42
  • I'm assuming, you've not deployed the function as a serverless function, but rather a static file. Note that, on Netlify, you need to add the `tweet.js` in the `/netlify/functions` folder for it to be deployed as a serverless function. – Hrishikesh Kokate Jun 25 '22 at 16:57
  • Yes @HrishikeshKokate I did add it in /netlify/functions folder – Probably Arth Jun 25 '22 at 18:17
  • In that case, you might have set a different Functions directory in Netlify. Could you share your site URL, or folks could see what is happening? – Hrishikesh Kokate Jun 26 '22 at 05:01

0 Answers0