Closed KABBOUCHI closed 3 years ago
I appreciate the report - thanks @KABBOUCHI โค๏ธ
Resolved upstream - will be fixed with the next release ๐
@manniL just tried v0.2.1
, still getting req undefined in nuxtServerInit
FYI
export const actions = {
nuxtServerInit({ commit }, { req }) {
// req is undefined here
However I am using Nuxt 2.15.4 and not nuxt-edge so apologies if that's the reason.
@manniL just tried
v0.2.1
, still getting req undefined innuxtServerInit
FYIexport const actions = { nuxtServerInit({ commit }, { req }) { // req is undefined here
However I am using Nuxt 2.15.4 and not nuxt-edge so apologies if that's the reason.
UPDATE Could you provide a repro for this scenario? The missing req/res object should've been fixed with Nitro v0.2.1
Old
Having an undefined req
object is not part of the original issue reported here. However, I've experienced a similar behavior a couple of days ago and reported the bug :)
So - WIP again ๐ -
Apologies, I reported the missing req in CF via PM a few weeks back and mistook this to be similar. I'll create a repro and create a new issue to avoid polluting this one ๐
Apologies, I reported the missing req in CF via PM a few weeks back and mistook this to be similar. I'll create a repro and create a new issue to avoid polluting this one ๐
Just double checked and can still repro missing req
when using nitro, even in dev mode. Maybe squashing this bug could resolve the issue in prod too.
Released in v0.2.2
@manniL I was trying the new update but there a new issue:
Absolute path is throwing an error (full URL is working fine)
$fetch('/api/quotes')
this repo/demo has this error too https://nitro-demo.vercel.app/api
probably from this: https://github.com/nuxt/nitro-demo/blob/a469eb6eaaed301b79eaa841b64e3b2588fe9f4e/pages/api.vue#L37-L39
Thanks for report @KABBOUCHI. API error was due to a regression in h3. All should be fine in the latest releases. https://nitro-demo.vercel.app/api
https://github.com/KABBOUCHI/nuxt-nitro-demo/blob/bc8fd5f0bd767598d1939eeb7e89c295a3d37596/server/api/hello.ts#L1-L13
Vercel: https://nuxt-nitro-demo.vercel.app/api/hello?test1=1&test2=2
Netlify: https://nuxt-nitro-demo.netlify.app/api/hello?test1=1&test2=2
url should be
event.path
+event.queryStringParameters
possible solution:
Cloudflare: https://nuxt-nitro-demo.kabbouchi.workers.dev/api/hello?test1=1&test2=2