The Next.js Edge Runtime is based on standard Web APIs, which is used by Middleware and Edge API Routes.
ReadableStreamReadableStreamBYOBReaderReadableStreamDefaultReaderTransformStreamWritableStreamWritableStreamDefaultWriterArrayArrayBufferAtomicsBigIntBigInt64ArrayBigUint64ArrayBooleanclearIntervalclearTimeoutconsoleDataViewDatedecodeURIdecodeURIComponentencodeURIencodeURIComponentErrorEvalErrorFloat32ArrayFloat64ArrayFunctionInfinityInt8ArrayInt16ArrayInt32ArrayIntlisFiniteisNaNJSONMapMathNumberObjectparseFloatparseIntPromiseProxyRangeErrorReferenceErrorReflectRegExpSetsetIntervalsetTimeoutSharedArrayBufferStringSymbolSyntaxErrorTextDecoderTextEncoderTypeErrorUint8ArrayUint8ClampedArrayUint16ArrayUint32ArrayURIErrorURLURLSearchParamsWeakMapWeakSetWebAssemblyYou can use process.env 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:
console.log(process.env) // { NEXT_RUNTIME: 'edge' } console.log(process.env.TEST_VARIABLE) // { NEXT_RUNTIME: 'edge', TEST_VARIABLE: 'value' }
The Edge Runtime has some restrictions including:
node_modules can be used, as long as they implement ES Modules and do not use native Node.js APIsrequire directly is not allowed. Use ES Modules insteadThe following JavaScript language features are disabled, and will not work:
eval: Evaluates JavaScript code represented as a stringnew Function(evalString): Creates a new function with the code provided as an argument