Skip to content

fix: bun undici polyfill issue, only initialize safeDispatcher if skipSafeFetch is false #13032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

geminigeek
Copy link
Contributor

hi,
currently we are initializing safeDispatcher outside of the safeFetch function, which is causing edge case issue with bun and undici polyfill

like this

const safeDispatcher = new Agent().compose(ssrfFilterInterceptor)

if we move this to the function safeFetch , we can get rid of edge case (see below) , if user set skipSafeFetch: true.

i have implemented this like that in this PR, till bun fixes undici polyfill issue this is a temporary fix.

related issues payload
#12622 (comment) #12622 (comment)

related issues Bun
oven-sh/bun#17799
oven-sh/bun#20022

… false

hi, 
currently we are initializing safeDispatcher outside of the safeFetch function, which is causing edge case issue with bun and undici polyfill

like this 
https://github.com/payloadcms/payload/blob/30fc7e3012dae81b3f727b35ff6917e75f271df1/packages/payload/src/uploads/safeFetch.ts#L52

if we move this to the function safeFetch  , we can get rid of edge case like these , if user set `skipSafeFetch: true`.

i have implemented this like that in this PR, till bun fixes undici polyfill issue this is a temporary fix.


related issues payload
payloadcms#12622 (comment)
payloadcms#12622 (comment)


related issues Bun
oven-sh/bun#17799
oven-sh/bun#20022
@geminigeek geminigeek changed the title fix: bun undici issue only initialize safeDispatcher if skipSafeFetch is false fix: bun undici pollyfill issue, only initialize safeDispatcher if skipSafeFetch is false Jul 3, 2025
@geminigeek geminigeek mentioned this pull request Jul 3, 2025
@geminigeek geminigeek changed the title fix: bun undici pollyfill issue, only initialize safeDispatcher if skipSafeFetch is false fix: bun undici polyfill issue, only initialize safeDispatcher if skipSafeFetch is false Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant