Closed DaleLJefferson closed 1 year ago
Hi @DaleLJefferson!
Great job for finding this. 🙌 We have #61 in the pipeline to support most edge environments generically (see src/edge.ts:30 for that fetch binding), but this is exactly how to achieve this at present.
For this, we could probably try to bind to fetch
if we find it as a global to avoid you having to do this manually.
Great to see you are working on this. I'm planning on using inngest in edge and non edge functions if that confuses things.
serve - standard node function NextJS / Vercel client - node and edge functions NextJS / Vercel
I would suggest that while the serve function is platform specific, the client should not be, it work on anywhere by detecting the environment (it should just need fetch I guess). i.e. I should not have to import import {Inngest} from "inngest/edge"
Aye, the client should definitely be environment agnostic.
Will reference this with a PR to fix!
Thanks for sorting this out ⭐
When using NextJS * Vercel Edge functions
fetch
is not correctly detected.Looking at the code https://github.com/inngest/inngest-js/blob/main/src/components/Inngest.ts#L129 it looks like if you don't provide a fetch in the constructor it falls back to using cross-fetch, which I guess thinks the edge functions are a browser and tries to use XMLHttpRequest polyfil.
As a workaround supplying fetch seems to work and I'm able to send events.