-
Notifications
You must be signed in to change notification settings - Fork 158
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
After upgrading v1.19.0->1.20.0: failed to load plugin...please provide a valid path #1673
Comments
Hey @el2iot2. Thanks for reporting. We are looking into it ASAP. |
@el2iot2 the error message is most likely misleading and there may be something related to your plugin. We are improving the error message in the next release but meanwhile would you be able to share the minimal repro as a zip archive? As i was not able to reproduce it with the details you provided above (I had to comment out utils.js and x2/x3 requires). |
Yeah, I am sorry. I have been attempting to remove client-specific/internal details to varying success. I have tried to pare back internals to a simple repro, and after stripping out all but the most simple, it worked fine. So that doesn't help me (or you) understand what happened. However, running with the new plugin import error version (1.20.1), I am now getting the following on the full (massive) project: Something went wrong when processing :
- Failed to load plugin "plugins/myapi.js": 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 's:'
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 's:'
at new NodeError (node:internal/errors:405:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:216:11)
at defaultLoad (node:internal/modules/esm/load:118:3)
at ModuleLoader.load (node:internal/modules/esm/loader:388:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:270:56)
at new ModuleJob (node:internal/modules/esm/module_job:65:26)
at #createModuleJob (node:internal/modules/esm/loader:282:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:240:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:221:17)
at async ModuleLoader.import (node:internal/modules/esm/loader:307:23) I think this is notable as my plugin path has simply been |
Aha. As soon as I posted, i realized that my repro was running on my desktop, so would be me@machine S:\repro\specs
> npx @redocly/cli@1.20.0 check-config
╔═══════════════════════════════════════════════════════╗
║ ║
║ A new version of Redocly CLI (1.20.1) is available. ║
║ Update now: `npm i -g @redocly/cli@latest`. ║
║ Changelog: https://redocly.com/docs/cli/changelog/ ║
║ ║
╚═══════════════════════════════════════════════════════╝
Something went wrong when processing :
- Failed to load plugin "plugins/repro.js". Please provide a valid path |
> npx @redocly/cli@1.20.1 check-config
Something went wrong when processing :
- Failed to load plugin "plugins/repro.js": 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 's:'
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 's:'
at new NodeError (node:internal/errors:405:5)
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:216:11)
at defaultLoad (node:internal/modules/esm/load:118:3)
at ModuleLoader.load (node:internal/modules/esm/loader:388:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:270:56)
at new ModuleJob (node:internal/modules/esm/module_job:65:26)
at #createModuleJob (node:internal/modules/esm/loader:282:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:240:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:221:17)
at async ModuleLoader.import (node:internal/modules/esm/loader:307:23) I have attached the repro zip, but I suspect just running in windows on a drive other than |
Thanks @el2iot2! It explains it. We're working on a fix. |
This is also breaking the vs code extension. Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, node, and electron are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11)
at defaultLoad (node:internal/modules/esm/load:129:3)
at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
at new ModuleJob (node:internal/modules/esm/module_job:67:26)
at #createModuleJob (node:internal/modules/esm/loader:290:17)
at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:247:34)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:228:17)
at async ModuleLoader.import (node:internal/modules/esm/loader:315:23)
at r (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:126:1212)
at async c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:128:268
at async Promise.all (index 0)
at async XM (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:128:77)
at async ZM (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:129:3073)
at async Z8 (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:129:3897)
at async Iye (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:126:576)
at async u3e (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:130:6374)
at async j_ (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:247:18024)
at async _a (c:\Users\fieljere\.vscode\extensions\redocly.openapi-vs-code-0.4.8\out\server\src\server.js:247:18171)
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Failed to load plugin "./linting/plugins/index.js": Only URLs with a scheme in: file, data, node, and electron are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' commenting out my |
just fyi.. vs code has plans to release with full ESM support very soon. (rollout begins tomorrow 8/30) |
- tested in Windows - no tested in Linux
- tested in Windows - no tested in Linux
Hi @el2iot2, could you check if it works for you in v1.23.0? |
Yep. Will report back once i have checked. |
Yes, it appears to avoid the issue when running from the s: drive: > npx @redocly/cli@1.23.0 check-config
╔═══════════════════════════════════════════════════════╗
║ ║
║ A new version of Redocly CLI (1.23.1) is available. ║
║ Update now: `npm i -g @redocly/cli@latest`. ║
║ Changelog: https://redocly.com/docs/cli/changelog/ ║
║ ║
╚═══════════════════════════════════════════════════════╝
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Deprecated plugin format detected: myapi
Properties 'enumSkipQuotes', 'sortOperationsAlphabetically', 'sortTagsAlphabetically', 'htmlTemplate', 'theme' are only used in API Reference Docs and Redoc version 2.x or earlier.
✅ Your config is valid. I also see that 1.23.1 also appears to work without error. What would I be doing that makes this "deprecated" and how can I fix it? |
@el2iot2 thank you very much for the feedback!
The docs have been updated recently to reflect the change: https://redocly.com/docs/cli/custom-plugins#plugin-structure. In short, the new syntax requires wrapping the plugin object with an IIFE function. The changes were applied since this PR. Hope that helps. Meanwhile, I'm closing the issue since it appears to be resolved. Please let me know if you think we should do anything else here. |
That did the trick. I am back to a valid plugin. Thanks! |
After upgrading to v1.20.0, the JavaScript plugin that I wrote was no longer found and prevented commands from working:
Works in v1.19.0
Fails in v1.20.0
OpenAPI description
OpenApi: 3.1
.redocly.yaml
plugins/myplugin.js
plugins/decorators/x-audience.js
Node.js
Version(s)Additional context
Running via NPX.
The text was updated successfully, but these errors were encountered: