Hi everyone
Hi everyone,
Need some help deploying Nuxt3 server middleware on cloudflare pages/workers
My nuxt3 static website is deploying well on cloudflare pages.
I'm trying to deploy server middleware/api/routes to cloudflare workers, but i don't figure out how it should be done.
Reading documentation let me think it should be done automatically... but also i should perhaps use wrangler ? or define NITRO_PRESET=cloudflare-pages ?
Thank's for your help
2 Replies
Update : i found out that i should use the build system 2 (beta) of cloudflare instead of build system 1 and use yarn build instead of yarn generate .
Seems can't have static page generation AND functions (via cloudflare workers) at the same time ... and should go full SSR in order to have server middlware on cloudflare workers.
by the way, i still have errors when publishing function
Error: Failed to publish your Function. Got error: Uncaught ReferenceError: global is not defined
at functionsWorker-0.44375225168792043.js:52342:10
Hi there!
I could make it work with SSR.
Set
NITRO_PRESET=cloudflare_pages
in env variables.
SSR also works
Btw, I couldn't make server routes work