-
Notifications
You must be signed in to change notification settings - Fork 40
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
crypto is not defined #61
Comments
Where are you running this? As the README says, this is "for environments that support fetch and SubtleCrypto" |
in a Nodejs app which supports |
Which Node.js version? Which OS?
Sent from Gmail Mobile
…On Mon, 29 Jan 2024 at 7:30 pm, Dibo ***@***.***> wrote:
AwsClient
in a Nodejs app which supports fetch
—
Reply to this email directly, view it on GitHub
<#61 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACZ2QDN2NCCD2BFITRRBOTYQ5MY5AVCNFSM6AAAAABCBBRG2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJUGE4TMNBZGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Node v20 |
Not sure what's wrong with your env – it's defined for me:
|
HI $ node
Welcome to Node.js v18.18.2.
Type ".help" for more information.
> typeof crypto
'object' May it wouldbe of help. |
this wo'nt work here because aws4fetch is an external package and we cannot modify its code base |
@its-dibo , try adding the Vercel Edge Runtime Polyfill (https://edge-runtime.vercel.app/packages/ponyfill) package: pnpm add @edge-runtime/ponyfill then to use it: import { crypto } from '@edge-runtime/ponyfill' |
In case anyone is having this problem running export default defineNuxtPlugin(() => {
const config = useRuntimeConfig();
if (process.server && config.public.env.toLocaleLowerCase() !== 'prod') {
const crypto = require('crypto');
global.crypto = crypto;
}
}) |
I got this error
the code:
I don't use
crypto
anywhere in my codeeven installing crypto doesn't help
npm i crypto
The text was updated successfully, but these errors were encountered: