Open paales opened 1 year ago
@paales, to fix the error, just pass setTimeout
to the batchScheduleFn
option when you create your DataLoader (see: https://github.com/graphql/dataloader#batch-scheduling).
Since setTimeout
have a delay of 4ms after 5 timeout on some runtime, it can however create performance issues (see https://github.com/vercel/next.js/discussions/44643)
@fdecampredon That might be a solution, still a bug imo :)
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
Middleware / Edge (API routes, runtime)
Link to the code that reproduces this issue
https://github.com/graphcommerce-org/graphcommerce/pull/1772
To Reproduce
Try and import facebook/dataloader in an edge function.
Describe the Bug
Nextjs gives an error that a node API 'nextTick' is used. However it actually checks in the code if nextTick is available: https://github.com/graphql/dataloader/blob/420573bc45cc55df096053efd743bcf5e9258c0e/src/index.js#L232-L246
Expected Behavior
I would expect this to just work.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response