Remix on Edge functions

I want to deploy an existing remix site to the edge. I used export const config = { runtime: "edge" }; as described in the documentation but got this error:

Error: The Edge Function "login" is referencing unsupported modules:
    - vcns/0/build/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/index.js: node:stream, remix-i18next/server, remix-i18next/react
    - @remix-run: @remix-run/web-fetch, node:crypto, node:fs, node:path, node:stream, node:fs/promises, node:os
    - cookie-signature: crypto
    - stream-slice: stream
    - undici: node:stream, node:net, node:tls, node:diagnostics_channel, node:http, node:querystring, node:url, node:console, node:util/types, node:zlib, node:perf_hooks, node:worker_threads, string_decoder

I couldn’t found documentation about how to handle unsupported modules in Remix on edge functions. Where can I see what to do?

Hello and welcome to the community, @cjoecker!

The Edge Runtime isn’t exactly the same as the Node.js Runtime. It looks like you’ve run into a compatibility issue since the code uses unsupported APIs. The fastest solution is to just switch back to Node instead of Edge functions. But if you’re up for some code changes, you can find the list of supported APIs here: Edge Runtime

I hope that helps!

1 Like

@amyegan thanks for the fast answer!

I could solve the errors by replacing @remix-run/node with @vercel/remix as described in the docs. But remix-i18next module is not supported. I get this error now:

Error: The Edge Function "login" is referencing unsupported modules:
	- __vc__ns__/0/build/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/index.js: remix-i18next/server, remix-i18next/react

I think it’s important to solve this issue if you want to support Remix in edge functions for business apps. Right now is like having a Ferrari without the wheels.

Edge function is mostly attractive for applications deployed globally where internationalization is important and remix-i18next is the most used i18n library in Remix. I mentioned it to Lee Robinson here.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.