Error: [unenv] fs.readFile is not implemented yet when getting presigned url with s3 packages.

I am trying to get a presigned put url for my R2 bucket, but getting the above error when getSignedUrl is executed.
const R2_URL = `https://${ctx.env.ACCOUNT_ID}.r2.cloudflarestorage.com`
const s3Client = new S3Client({
region: "auto",
endpoint: R2_URL,
credentials: {
accessKeyId: ctx.env.ACCESS_KEY_ID,
secretAccessKey: ctx.env.ACCESS_KEY,
},
})
const objectKey = `${app.slug}/${input.name}`
const cmd = new PutObjectCommand({
Bucket: ctx.env.BUCKET_NAME,
Key: objectKey,
})
const signedUrl = await getSignedUrl(s3Client, cmd, { expiresIn: 3600 })
const R2_URL = `https://${ctx.env.ACCOUNT_ID}.r2.cloudflarestorage.com`
const s3Client = new S3Client({
region: "auto",
endpoint: R2_URL,
credentials: {
accessKeyId: ctx.env.ACCESS_KEY_ID,
secretAccessKey: ctx.env.ACCESS_KEY,
},
})
const objectKey = `${app.slug}/${input.name}`
const cmd = new PutObjectCommand({
Bucket: ctx.env.BUCKET_NAME,
Key: objectKey,
})
const signedUrl = await getSignedUrl(s3Client, cmd, { expiresIn: 3600 })
1 Reply
Ahmed Eid
Ahmed EidOP2mo ago
unable to tell what I am doing wrong.
Want results from more Discord servers?
Add your server