Incompatibility with Miniflare
Erisa opened this issue · 1 comments
Erisa commented
When attempting to use this template with Miniflare, the following error is encountered:
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
(node:17421) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
(Use `node --trace-warnings ...` to show where the warning was created)
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
This occurs once on load, and then subsequently on every request made by Discord (for example the ping test sent when setting the Interactions endpoint) and the bot does not function.
Steps followed:
- Clone or degit clone the repo.
- Install deps:
$ yarn
- Install miniflare:
$ npm install -g miniflare
- Populate
.env
withDISCORD_APP_ID
,DISCORD_PUBLIC_KEY
andDISCORD_BOT_TOKEN
- Run
$ miniflare -e .env
Environment used:
Ubuntu 22.04 Beta in WSL2 with node 16.14.0 from asdf.
Also happened on a GitHub Codespace default image last week.
Click to show full output:
erisa@Tuturu:~/slash-create-worker$ miniflare -e .env
> build
> webpack
(node:17499) [DEP_WEBPACK_MODULE_ERRORS] DeprecationWarning: Module.errors was removed (use getErrors instead)
(Use `node --trace-deprecation ...` to show where the warning was created)
asset worker.js 115 KiB [emitted] [minimized] (name: main)
runtime modules 432 bytes 3 modules
modules by path ./node_modules/ 278 KiB
modules by path ./node_modules/slash-create/lib/ 157 KiB 37 modules
+ 4 modules
modules by path ./src/ 9.05 KiB
modules by path ./src/shim/ 7.33 KiB 5 modules
modules by path ./src/commands/*.ts 866 bytes 2 modules
+ 1 module
optional modules 45 bytes [optional]
express (ignored) 15 bytes [optional] [built] [code generated]
fastify (ignored) 15 bytes [optional] [built] [code generated]
fastify/lib/symbols (ignored) 15 bytes [optional] [built] [code generated]
+ 5 modules
WARNING in ./node_modules/slash-create/lib/command.js 155:27-49
Critical dependency: the request of a dependency is an expression
@ ./node_modules/slash-create/lib/index.js 29:13-33
@ ./src/shim/creator.ts 4:23-46
@ ./src/shim/index.ts 13:13-33
@ ./src/index.ts 5:15-32
WARNING in ./node_modules/slash-create/lib/creator.js 131:30-47
Critical dependency: the request of a dependency is an expression
@ ./node_modules/slash-create/lib/index.js 30:13-33
@ ./src/shim/creator.ts 4:23-46
@ ./src/shim/index.ts 13:13-33
@ ./src/index.ts 5:15-32
2 warnings have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.69.1 compiled with 2 warnings in 2958 ms
[mf:inf] Build succeeded
[mf:inf] Worker reloaded! (115.08KiB)
[mf:inf] Listening on :8787
[mf:inf] - http://127.0.0.1:8787
[mf:inf] - http://172.26.110.44:8787
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
[mf:inf] Updated Request cf object cache!
GET / 405 Method Not Allowed (9.51ms)
GET /favicon.ico 405 Method Not Allowed (1.88ms)
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
(node:17421) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
(Use `node --trace-warnings ...` to show where the warning was created)
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
[mf:err] Unhandled Promise Rejection: SyntaxError: Unsupported key usage for a NODE-ED25519 key
at verifyAcceptableEcKeyUse (node:internal/crypto/ec:86:11)
at Object.ecImportKey (node:internal/crypto/ec:411:11)
at Proxy.importKey (node:internal/crypto/webcrypto:489:10)
at Object.6205 (/home/erisa/slash-create-worker/dist/worker.js:7:49825)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.936 (/home/erisa/slash-create-worker/dist/worker.js:7:46659)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
at Object.9569 (/home/erisa/slash-create-worker/dist/worker.js:7:48060)
at r (/home/erisa/slash-create-worker/dist/worker.js:7:82488)
^C
Snazzah commented
Fixed in 8806ad0, seemed like slshx solved this before.
Make sure to update src/shim/util/verify.ts.