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

For some reason I keep getting 401 Authentication error after performing "Create your studio" action #50

Open
Deuris opened this issue Jul 4, 2023 · 10 comments

Comments

@Deuris
Copy link

Deuris commented Jul 4, 2023

I can't understand what causes this error, I've checked the S3 bucket permissions and policies and everything seems fine.

@JustinMKY
Copy link

I get this too, have you found solution to this?

@Deuris
Copy link
Author

Deuris commented Jul 17, 2023

I get this too, have you found solution to this?

No, I haven't(

@JustinMKY
Copy link

I think I found solution, need to create bucket policy and cors policy on bucket

@Deuris
Copy link
Author

Deuris commented Jul 17, 2023 via email

@JustinMKY
Copy link

My solution says the bucket is public though, I tried setting principals but for some reason it doesn't work and gives 401 error.

Here is my set up though:

  • I unchecked fourth option in Block Public Access (Block public and cross-account access to buckets and objects through any public bucket or access point policies)

My bucket policy is

{
    "Version": "2012-10-17",
    "Id": "Policy1689384910025",
    "Statement": [
        {
            "Sid": "Stmt1689384810241",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": "arn:aws:s3:::bucketName/*"
        }
    ]
}

CORS policy on bucket

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "POST",
            "DELETE",
            "HEAD"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": [
            "x-amz-server-side-encryption",
            "x-amz-request-id",
            "x-amz-id-2",
            "ETag"
        ],
        "MaxAgeSeconds": 3000
    }
]

@Navya-re
Copy link

i get this error in browser

POST https://last-vert.vercel.app/api/s3-upload 405

(anonymous) @ 226-1d6c8af1b9ec75f3.js:100
f @ 226-1d6c8af1b9ec75f3.js:100
n.value @ 226-1d6c8af1b9ec75f3.js:100
(anonymous) @ 226-1d6c8af1b9ec75f3.js:100
oJ @ 226-1d6c8af1b9ec75f3.js:100
a @ 226-1d6c8af1b9ec75f3.js:100
(anonymous) @ 226-1d6c8af1b9ec75f3.js:100
r @ 226-1d6c8af1b9ec75f3.js:100
uploadToS3 @ 226-1d6c8af1b9ec75f3.js:100
L @ dashboard-62dc7448791a4034.js:1
await in L (async)
eV @ framework-3b5a00d5d7e8d93b.js:9
eW @ framework-3b5a00d5d7e8d93b.js:9
(anonymous) @ framework-3b5a00d5d7e8d93b.js:9
rn @ framework-3b5a00d5d7e8d93b.js:9
rt @ framework-3b5a00d5d7e8d93b.js:9
(anonymous) @ framework-3b5a00d5d7e8d93b.js:9
oN @ framework-3b5a00d5d7e8d93b.js:9
eF @ framework-3b5a00d5d7e8d93b.js:9
ri @ framework-3b5a00d5d7e8d93b.js:9
nV @ framework-3b5a00d5d7e8d93b.js:9
nI @ framework-3b5a00d5d7e8d93b.js:9
VM102:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input
await (async)
eV @ framework-3b5a00d5d7e8d93b.js:9
eW @ framework-3b5a00d5d7e8d93b.js:9
(anonymous) @ framework-3b5a00d5d7e8d93b.js:9
rn @ framework-3b5a00d5d7e8d93b.js:9
rt @ framework-3b5a00d5d7e8d93b.js:9
(anonymous) @ framework-3b5a00d5d7e8d93b.js:9
oN @ framework-3b5a00d5d7e8d93b.js:9
eF @ framework-3b5a00d5d7e8d93b.js:9
ri @ framework-3b5a00d5d7e8d93b.js:9
nV @ framework-3b5a00d5d7e8d93b.js:9
nI @ framework-3b5a00d5d7e8d93b.js:9

@JustinMKY
Copy link

JustinMKY commented Jul 22, 2023

i get this error in browser

POST https://last-vert.vercel.app/api/s3-upload 405

(anonymous) @ 226-1d6c8af1b9ec75f3.js:100 f @ 226-1d6c8af1b9ec75f3.js:100 n.value @ 226-1d6c8af1b9ec75f3.js:100 (anonymous) @ 226-1d6c8af1b9ec75f3.js:100 oJ @ 226-1d6c8af1b9ec75f3.js:100 a @ 226-1d6c8af1b9ec75f3.js:100 (anonymous) @ 226-1d6c8af1b9ec75f3.js:100 r @ 226-1d6c8af1b9ec75f3.js:100 uploadToS3 @ 226-1d6c8af1b9ec75f3.js:100 L @ dashboard-62dc7448791a4034.js:1 await in L (async) eV @ framework-3b5a00d5d7e8d93b.js:9 eW @ framework-3b5a00d5d7e8d93b.js:9 (anonymous) @ framework-3b5a00d5d7e8d93b.js:9 rn @ framework-3b5a00d5d7e8d93b.js:9 rt @ framework-3b5a00d5d7e8d93b.js:9 (anonymous) @ framework-3b5a00d5d7e8d93b.js:9 oN @ framework-3b5a00d5d7e8d93b.js:9 eF @ framework-3b5a00d5d7e8d93b.js:9 ri @ framework-3b5a00d5d7e8d93b.js:9 nV @ framework-3b5a00d5d7e8d93b.js:9 nI @ framework-3b5a00d5d7e8d93b.js:9 VM102:1 Uncaught (in promise) SyntaxError: Unexpected end of JSON input await (async) eV @ framework-3b5a00d5d7e8d93b.js:9 eW @ framework-3b5a00d5d7e8d93b.js:9 (anonymous) @ framework-3b5a00d5d7e8d93b.js:9 rn @ framework-3b5a00d5d7e8d93b.js:9 rt @ framework-3b5a00d5d7e8d93b.js:9 (anonymous) @ framework-3b5a00d5d7e8d93b.js:9 oN @ framework-3b5a00d5d7e8d93b.js:9 eF @ framework-3b5a00d5d7e8d93b.js:9 ri @ framework-3b5a00d5d7e8d93b.js:9 nV @ framework-3b5a00d5d7e8d93b.js:9 nI @ framework-3b5a00d5d7e8d93b.js:9

This seems like issues with s3 bucket permissions, check bucket permissions/CORS policies

EDIT: I posted CORS policy above, maybe try that and see if it works.

@Navya-re
Copy link

Nice , Thank You , It Worked

@Navya-re
Copy link

One Last Help Man ,
The Images generated are expiring after some time as they are automatically getting deleted from replicate , is there anything im missing s3 bucket , the images aren't uploading to bucket , is there any folder i need to create ?

@JustinMKY
Copy link

One Last Help Man , The Images generated are expiring after some time as they are automatically getting deleted from replicate , is there anything im missing s3 bucket , the images aren't uploading to bucket , is there any folder i need to create ?

I have not yet run into an issue like that, so wouldn't know, maybe check server logs and ensure replicate account have billing source added.

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

3 participants