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

2.4.3: ERR_UNSUPPORTED_ESM_URL_SCHEME on startup #17

Closed
TimGuendel opened this issue Nov 24, 2023 · 4 comments
Closed

2.4.3: ERR_UNSUPPORTED_ESM_URL_SCHEME on startup #17

TimGuendel opened this issue Nov 24, 2023 · 4 comments

Comments

@TimGuendel
Copy link

TimGuendel commented Nov 24, 2023

After upgrading to 2.4.3, I am getting this error when starting my Nuxt App:

✔ Nitro built in 3651 ms nitro 09:01:43
[nitro] [unhandledRejection] Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:136:11)
at defaultLoad (node:internal/modules/esm/load:87:3)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:603:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

My nuxt config:

    proxy: {
        proxies: {
            '/api': {
                target: process.env.BACKEND_URL,
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ''),
                xfwd: true,
                configure: (proxy) => {
                    proxy.on('proxyReq', (proxyReq) => {
                        console.log('proxyReq', proxyReq);
                    });
                },
            },
        },
    },
@Denoder
Copy link
Member

Denoder commented Nov 24, 2023

Unfortunately, I don't test modules in a Windows environment, so I am unable to provide assistance or a fix as to fixing the path issue on this line:

const functionModule = await import(`${options.buildDir}/nuxt-proxy-functions.mjs`)

You can make a pull request if you do know a solution.

Denoder added a commit that referenced this issue Nov 24, 2023
@Denoder Denoder closed this as completed Nov 24, 2023
@TimGuendel
Copy link
Author

Thanks for the new version - now with 2.4.4 I am now getting this error 🤔

✔ Nitro built in 4670 ms nitro 13:33:01
[nitro] [unhandledRejection] TypeError: Cannot read properties of undefined (reading 'configure')
at getFunction (C:\dev\frontend-web-2\node_modules@nuxt-alt\proxy\dist\runtime\proxy-plugin.nitro.mjs:101:55)
at async Promise.all (index 1)
at (C:\dev\frontend-web-2\node_modules@nuxt-alt\proxy\dist\runtime\proxy-plugin.nitro.mjs:12:3)

@Denoder
Copy link
Member

Denoder commented Nov 24, 2023

@TimGuendel should be fixed now

@TimGuendel
Copy link
Author

@TimGuendel should be fixed now
Wow, thanks! It's working now 👍

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

2 participants