fetch failing on edge function/occasionally works
Unanswered
European sprat posted this in #help-forum
European spratOP
I've been troubleshooting my code for days trying to understand why a fetch in my api/webhook route is not working. Locally it functions every time. very infrequently it will work via my vercel deployment. I have attempted to console.log every step of the way and according to the logs on vercel, the function stops at the fetch command. no errors are logged. copying the fetch from an api route to a component, the fetch works fine. i've tried refactoring with axios. I've tried completing a more simple get request. I'm not sure how else to troubleshoot. I know the docs state fetch works on edge functions, but I can't get mine to. any help would be appreciated.
1 Reply
European spratOP
my solution: i have refactored to use client.create() method from sanity instead of a post request using fetch.