keko92
keko92
CDCloudflare Developers
Created by keko92 on 7/23/2023 in #pages-help
Unable to use @aws-sdk/client-s3 in Nuxt 3 Pages
Are the provided exmaples enough to reproduce the problem or do you need additional information @cherryjimbo ? If it helps here is the deployment id: adb468ae-806a-484b-8089-866c5e63bd13
9 replies
CDCloudflare Developers
Created by keko92 on 7/23/2023 in #pages-help
Unable to use @aws-sdk/client-s3 in Nuxt 3 Pages
@cherryjimbo aditionaly I created this Nuxt 3 starter repository which produces the same error: https://github.com/FISCHKE/cloudflare-pages
9 replies
CDCloudflare Developers
Created by keko92 on 7/23/2023 in #pages-help
Unable to use @aws-sdk/client-s3 in Nuxt 3 Pages
Thanks @cherryjimbo for the support. In my case it is a freshly created Nuxt 3.6.5 project with an api route initalizing a new S3Client: I can get my deployment working when I move the initializing of the s3Client into the "defineEventHandler" . But then I am getting the "Cannot convert object to primitive value" error when calling the api route.
import { S3Client } from "@aws-sdk/client-s3";

const s3Client = new S3Client({
region: "eu-central-1",
endpoint: "",
forcePathStyle: true,
credentials: {
accessKeyId: "",
secretAccessKey: "",
},
});

export default defineEventHandler(async (event) => {
return {
hello: "world",
};
});
import { S3Client } from "@aws-sdk/client-s3";

const s3Client = new S3Client({
region: "eu-central-1",
endpoint: "",
forcePathStyle: true,
credentials: {
accessKeyId: "",
secretAccessKey: "",
},
});

export default defineEventHandler(async (event) => {
return {
hello: "world",
};
});
9 replies