Replies: 1 comment 1 reply
-
Hi @dbzx10299! Next time, you might have better luck asking this type of question over in the Netlify Support Forums. I just happened to be passing by here and saw this question! You can see in the code you pasted that Netlify's generated edge function runs on What is your use case for your edge function that returns a response when using edge SSR? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a site hosted on netlify and I am using Nuxt 3. I was using the
npm run generate
command and I had in my nuxt file structure anetlify
directory with edge functions (/netlify/edge-functions/foo.js
).I wanted to move away from SSG and start using SWR and leveraging the cache so rather than pre-rendering the entire site I set the netlify build command to
npm run build
. This requires the nitro config to be set a bit differently as documented in the netlify docs for using nuxt on netlify:In my
nuxt.config.ts
file I set this upNow when I run this edge function from
/netlify/edge-functions/foo.js
I get an error
It seems this is happening because the nuxt
pages
directory is scanned and the pages are being served. If there would be a pagebar.vue
(/pages/bar.vue
)It appears that this page is being served from the edge which is pretty cool. But how can I set this up that my edge functions in
/netlify/edge-functions/foo.js
still work?Another interesting thing is that when the build command runs on netlify, it shows that the edge functions are bundled. When the nitro
netlify_edge
preset is used though, trying to fetch foo fails since it isn‘t a page. Also runningnetlify dev
works as I would expect, so something here must be happening with the nitro output that I don't understand.I can see here in the source code what is going on, but I don't get why I can't hit the edge function as an endpoint.
Beta Was this translation helpful? Give feedback.
All reactions