I have a script to sync a directory to an R2 bucket, and running it locally with all my env stuff in .env works fine. Uploading .env to the environment variables for my deployment build settings, and trying to deploy, it fails and gives me Error: AccessDenied: Access Denied, when this gets executed:
const response = await r2Client.send(
new ListObjectsV2Command({
Bucket: BUCKET_NAME,
ContinuationToken: continuationToken,
})
);