Skip to content

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

Open
geminigeek wants to merge 1 commit into
payloadcms:mainfrom
geminigeek:patch-3
Open

geminigeek wants to merge 1 commit into
payloadcms:mainfrom
geminigeek:patch-3

Conversation

@geminigeek

Copy link
Copy Markdown
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
@denolfe denolfe added the v3 label Apr 23, 2026

This branch has not been deployed

No deployments
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.

2 participants