Unable to use AWS SDK v3 in edge functions.
I want to call Bedrock API using AWS SDK v3. It was working fine earlier, suddenly it stopped working.
Here is my code:
Here is the error:
Here is my code:
const bedrockClient = new BedrockRuntimeClient({
region: "ap-south-1",
credentials: {
accessKeyId: Deno.env.get("AWS_ACCESS_KEY_ID") || "",
secretAccessKey: Deno.env.get("AWS_SECRET_ACCESS_KEY") ||
"",
},
});
const response = await bedrockClient.send(
new InvokeModelCommand({
modelId: "amazon.titan-embed-image-v1",
contentType: "application/json",
accept: "application/json",
body: JSON.stringify({
inputText: query,
}),
}),
); const bedrockClient = new BedrockRuntimeClient({
region: "ap-south-1",
credentials: {
accessKeyId: Deno.env.get("AWS_ACCESS_KEY_ID") || "",
secretAccessKey: Deno.env.get("AWS_SECRET_ACCESS_KEY") ||
"",
},
});
const response = await bedrockClient.send(
new InvokeModelCommand({
modelId: "amazon.titan-embed-image-v1",
contentType: "application/json",
accept: "application/json",
body: JSON.stringify({
inputText: query,
}),
}),
);Here is the error:
Error: [unenv] fs.readFile is not implemented yet!\n at n (https://esm.sh/node/chunk-5A4BT3HD.mjs:1:22)\n at Object.assign.__unenv__ (https://esm.sh/node/chunk-5A4BT3HD.mjs:1:118)\n at l (https://esm.sh/@smithy/shared-ini-file-loader@3.1.12/es2022/shared-ini-file-loader.mjs:3:2129)\n at I (https://esm.sh/@smithy/shared-ini-file-loader@3.1.12/es2022/shared-ini-file-loader.mjs:3:2352)\n at https://esm.sh/@smithy/node-config-provider@3.1.12/es2022/node-config-provider.mjs:3:852\n at https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:757\n at eventLoopTick (ext:core/01_core.js:168:7)\n at async c (https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:910)\n at async https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:1009Error: [unenv] fs.readFile is not implemented yet!\n at n (https://esm.sh/node/chunk-5A4BT3HD.mjs:1:22)\n at Object.assign.__unenv__ (https://esm.sh/node/chunk-5A4BT3HD.mjs:1:118)\n at l (https://esm.sh/@smithy/shared-ini-file-loader@3.1.12/es2022/shared-ini-file-loader.mjs:3:2129)\n at I (https://esm.sh/@smithy/shared-ini-file-loader@3.1.12/es2022/shared-ini-file-loader.mjs:3:2352)\n at https://esm.sh/@smithy/node-config-provider@3.1.12/es2022/node-config-provider.mjs:3:852\n at https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:757\n at eventLoopTick (ext:core/01_core.js:168:7)\n at async c (https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:910)\n at async https://esm.sh/@smithy/property-provider@3.1.11/es2022/property-provider.mjs:2:1009