Open tksst opened 6 months ago
Occuring the same issue while using gr2m/universal-github-app-jwt. They obviously generate an ArrayBuffer, but importKey fails with the exact same type error.
I can also replicate it simply by doing await crypto.suble.importKey("pkcs8", new ArrayBuffer(), .....)
.
I wrote a simple test code.
new ArrayBuffer().constructor === ArrayBuffer
above code evaluated as false
on edge-runtime though i'm not sure why...
any update on this? seems to not give the same error on cloudflare workers
Same situation here in my local development. I have not yet pushed this up to Vercel to test in production.
Using next 14.0.4 and node 18.18.2. (also tried with node 20.16.0)
Node.js 20.11.1 edge-runtime@2.5.9
Bug Report
Current behavior
foo.js
:cmd:
result(error):
Expected behavior/code
Done without error
Additional context/screenshots
The above code has been verified to work with raw Node.js, Firefox and Chrome.
ArrayBuffer.prototype seems to be different from the original. Node.js checks here: https://github.com/nodejs/node/blob/9b1bf44ea9e7785e38c93b7d22d32dbca262df6c/lib/internal/crypto/webidl.js#L183
Wrapping with uint8array is a workaround: