Getting Error on Netlify Edge Functions (SvelteKit)

I recently migrated to Better Auth It works fine on node environment (on netlify) but It gives error on Netlify Edge Functions

Feb 18, 11:40:16 PM: 01JMD41S error  [render] 2025-02-18T18:10:16.656Z ERROR [Better Auth]: ReferenceError ReferenceError: Buffer is not defined
    at Object.verifyPassword [as verify] (file:///root/.netlify/edge-functions/render.js:21057:58)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async file:///root/.netlify/edge-functions/render.js:54103:37
    at async handle2 (file:///root/.netlify/edge-functions/render.js:15141:17)
    at async api.<computed> (file:///root/.netlify/edge-functions/render.js:21836:23)
    at async handler2 (file:///root/.netlify/edge-functions/render.js:15809:30)
    at async handler (file:///root/.netlify/edge-functions/render.js:15860:23)
    at async respond (file:///root/.netlify/edge-functions/render.js:82856:22)
    at async FunctionChain.runFunction (file:///root/src/bootstrap/function_chain.ts:492:22)
    at async FunctionChain.run (file:///root/src/bootstrap/function_chain.ts:361:20)


The error basically seems to be related to unavailability of Buffer.

Could it be possible to pollyfills it in some way or so (just wondering)
Screenshot_20250219_000031.png
Was this page helpful?