vercel / vercel/next.js

Docs: Does Edge Runtime support `Buffer`?

Open
#86,281 3 comments 0 reactions 1 assignee View on GitHub

@icyJoseph is already working on this.

Since Nov 19, 2025.

Dominant language
JavaScript
Stars
142k
Forks
32.5k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

What is the documentation issue?

https://nextjs.org/docs/pages/api-reference/edge
According to the Edge Runtime documentation, Buffer is not listed in the supported APIs.
However, based on our testing, Buffer appears to be supported and works without errors.

Is there any context that might help us understand?

I'm using Next.js v15.x and Pages Router.

I tried to implement Content Security Policy (CSP).
So I added the nonce by following the document:
https://nextjs.org/docs/15/pages/guides/content-security-policy#nonces

In the sample code, it uses Buffer.

const nonce = Buffer.from(crypto.randomUUID()).toString('base64')

But in the document about middleware, "Middleware defaults to using the Edge runtime".
https://nextjs.org/docs/15/app/api-reference/file-conventions/middleware#runtime

And I couldn't find Buffer in the supported APIs
https://nextjs.org/docs/pages/api-reference/edge

However, as long as I deployed and tested, it worked without errors.
Does it mean I can use Buffer in Edge Runtime?

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/pages/api-reference/edge

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.