Edge Runtime

    Encoding APIs

    Web Stream APIs

    Web Standards APIs

    You can use to access Environment Variables for both next dev and next build.

    Running console.log on process.env will not show all your Environment Variables. You have to access the variables directly as shown below:

    Unsupported APIs

    • Native Node.js APIs are not supported. For example, you can’t read or write to the filesystem
    • node_modules can be used, as long as they implement ES Modules and do not use native Node.js APIs
    • Calling directly is not allowed. Use ES Modules instead

    The following JavaScript language features are disabled, and will not work:

    • eval: Evaluates JavaScript code represented as a string
    • new Function(evalString): Creates a new function with the code provided as an argument
    • WebAssembly.compile
    • WebAssembly.instantiate with

    In rare cases, your code could contain (or import) some dynamic code evaluation statements which can not be reached at runtime and which can not be removed by treeshaking. You can relax the check to allow specific files with your Middleware or Edge API Route exported configuration:

    1. export const config = {
    2. unstable_allowDynamic: [
    3. '/lib/utilities.js', // allows a single file
    4. '/node_modules/function-bind/**', // use a glob to allow anything in the function-bind 3rd party module
    5. ],
    6. }

    Be warned that if these statements are executed on the Edge, they will throw and cause a runtime error.

    MiddlewareRun code before a request is completed.