AbhishekA
Convex Community11mo ago
18 replies
Abhishek

AI SDK giving crypto is not defined error

I am using vercel ai sdk (aws bedrock with sonnet), tried using both node and non node environment. But still I am getting this error

Uncaught ReferenceError: crypto is not defined
at hmac (../node_modules/aws4fetch/dist/aws4fetch.esm.mjs:219:4)
at signature [as signature] (../node_modules/aws4fetch/dist/aws4fetch.esm.mjs:181:22)
at authHeader [as authHeader] (../node_modules/aws4fetch/dist/aws4fetch.esm.mjs:173:15)
at sign [as sign] (../node_modules/aws4fetch/dist/aws4fetch.esm.mjs:160:4)
at <anonymous> (../node_modules/@ai-sdk/amazon-bedrock/src/bedrock-sigv4-fetch.ts:57:26)
at postToApi (../node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:65:14)
at postJsonToApi (../node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:28:4)
at doGenerate [as doGenerate] (../node_modules/@ai-sdk/amazon-bedrock/src/bedrock-chat-language-model.ts:243:6)
at async fn (../node_modules/ai/core/generate-text/generate-text.ts:350:16)
at async <anonymous> (../node_modules/ai/core/telemetry/record-span.ts:19:10)
Was this page helpful?