I’m trying to switch from deploying functions to edge functions on an existing netlify remix app. Have followed all the steps I can find and everything the AI suggested (changing entry.server,
npm install @netlify/remix-edge-adapter @netlify/remix-runtime,
npm install --dev @netlify/edge-functions, adapting vite.config.ts to use the edge functions plugin) but getting an Unexpected Server Error with no further info on the branch deploy. Not sure where to go from here - any wisdom?
@hrishikesh I have started with a fresh remix project using the netlify edge-functions template. I have one netlify app linked to my project (not connected to any repo). Then I created a simple function under the netlify/edge-functions following all proper guidelines. When I run the project locally with ‘netlify dev’ command it does not show me the edge function being deployed and instead shows below output:
=====================
^C[sachin@sachin-asus-vivobook edge-remix]$ ntl dev
◈ Netlify Dev ◈
◈ Injecting environment variable values for all scopes
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LANGUAGE (defined in process)
◈ Setting up local development server
Cleaned up .netlify/functions-internal.
◈ Starting Netlify Dev with Vite
dev
remix vite:dev
➜ Local: http://localhost:5173/
➜ Network: use --host to expose Waiting for framework port 5173. This can be configured using the ‘targetPort’ property in the netlify.toml
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:8888 │
│ │
└─────────────────────────────────────────────────┘
◈ Loaded edge function remix-server
==========================================
Also if I try to run the function with the given path at localhost it shows me ‘404 Not Found’ status.
I am clueless what could be the problem…! Any help ?
Thanks.
But on production as well I see same result - 404 Not Found… It means the functions are not being deployed at all. I even did the simplest thing - 1) create a project from the with ‘npx create-remix@latest --template netlify/remix-template’, 2) choose a project name, 3) chhose to install npm and run remix.init script, 4) choose edge functions; then immediatly linking the project to a Netlify site. Then create a simple hello.ts and a default hello world response and deply again - but no success with just 404 not found. What could be wrong then - Is Netlify remix template very obsolete ?
Here is the link: https://edge-remix.netlify.app
I have not created a git repo for this so if you want to review the code, please let me know; I will create and share the URL.
Quick update:
I could finally resolve the issue with following steps:
Pushed the project to a git repo
Unlinked the currently deployed site and deleted the site from Netlify UI
Recreated site with same name (edge-remix) from using CLI
After this whenI did ‘ntl build’ and ‘ntl deploy’ I could see the edge-function that I created was deplooyed which I could verify from the Deploy preview.
Thank you very much for the time you spent for reviewing my problem and suggesting.