Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt SSR DEV mode: proxyRequest does not work with node 19+ (works with 18) #698

Open
TimGuendel opened this issue Mar 11, 2024 · 0 comments

Comments

@TimGuendel
Copy link

Environment

Windows 11
Node Version Manager
Node 19.0.0
Nuxt 3.10.3
Nitro 2.8.1

Reproduction

I was not able to reproduce it, but maybe someone has an idea. I don't know how to debug this.

Describe the bug

This catch-all server middleware in my Nuxt App works with Node 18:

import { joinURL } from 'ufo';
export default defineEventHandler((event) => {
    const config = useRuntimeConfig();
    const path = event.path.replace(/^\/api\//, '');
    const target = joinURL(config.backendUrl, path);
    console.log('Proxy -->', target);
    return proxyRequest(event, target);
});

But when I use Node 19.0.0 or higher, the console.log is executed but then the webapp does not load anymore.
Replacing proxyRequest(event, target); with return event solves the problem.

This happens in DEV mode only. A production build works.

Additional context

No response

Logs

No response

@TimGuendel TimGuendel changed the title DEV mode: proxyRequest does not work with node 19+ (works with 18) Nuxt SSR DEV mode: proxyRequest does not work with node 19+ (works with 18) Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant