Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403 forbidden #51

Open
alkun-org opened this issue Oct 1, 2022 · 1 comment
Open

403 forbidden #51

alkun-org opened this issue Oct 1, 2022 · 1 comment

Comments

@alkun-org
Copy link

alkun-org commented Oct 1, 2022

I ran into this error today trying to use this library with DigitalOCean Spaces.
error: Uncaught (in promise) S3Error: Failed to put object: 403 Forbidden

My code as below

import { S3, S3Bucket } from "https://deno.land/x/[email protected]/mod.ts";

const s3 = new S3({
    accessKeyID: cfg.key,
    secretKey: cfg.secret,
    region: 'us-east-1',
    endpointURL: 'nyc3.digitaloceanspaces.com',
});

const bucket = s3.getBucket('myspace');

const fileName = '/tmp/about.json';
const text = await Deno.readTextFile(fileName);

const result = await bucket.putObject('about.json', text, {
    contentType: "application/json",
    acl: "public-read"
});

I've enabled CORS, set headers to '*' , enable all methods etc. I don't have issue accessing Spaces, just this API. Thanks.

@josephrocca
Copy link

josephrocca commented Oct 28, 2022

I also got this error. I ended up being able to bundle the browser/es6 code produced by skypack for the actual aws s3 package. Here's the code and process: https://gist.github.com/josephrocca/332e516102e039c2190a48da43519c5f

Maybe there's an easier way... I wasn't able to get npm:@aws-sdk/client-s3 working due to this: denoland/std#2557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants