W
Wasp-lang•3mo ago
đź•ł

AWS file uploading setup

I'm trying to setup file uploading with AWS following this documentation https://docs.opensaas.sh/guides/file-uploading/ and I'm at this part (first image attached) but I'm getting a lot of access denied errors. Sorry if this is a stupid question, but has anyone found a way around this?
No description
15 Replies
kapa.ai
kapa.ai•3mo ago
Hi @đź•ł. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry to hear that you're having trouble with setting up file uploading with AWS. Based on the knowledge sources provided, here are some steps you can follow: 1. First, you need to set up an S3 bucket and IAM user on AWS. Then, add these entries to your .env.server file:
AWS_S3_IAM_ACCESS_KEY=
AWS_S3_IAM_SECRET_KEY=
AWS_S3_FILES_BUCKET=
AWS_S3_REGION=
AWS_S3_IAM_ACCESS_KEY=
AWS_S3_IAM_SECRET_KEY=
AWS_S3_FILES_BUCKET=
AWS_S3_REGION=
(Source: Github Issue (open): Ability to serve and upload dynamic binary assets (images, pdfs) > Comments Part 1 (https://github.com/wasp-lang/wasp/issues/494)) 2. Add the AWS SDK to your list of dependencies:
dependencies: [
...
("aws-sdk", "^2.1294.0"),
...
]
dependencies: [
...
("aws-sdk", "^2.1294.0"),
...
]
(Source: Github Issue (open): Ability to serve and upload dynamic binary assets (images, pdfs) > Comments Part 1 (https://github.com/wasp-lang/wasp/issues/494)) 3. In your front end, set up the functions for downloading and uploading files:
const handleUploadFile = async () => {
...
let data = await getUploadFileSignedURL(...);
// key is the identifier of the file in S3
const { uploadUrl, key } = data;
// upload the actual file using the signed URL, newFile here is the file selected in the form
await axios.put(uploadUrl, newFile);
...
}
const handleUploadFile = async () => {
...
let data = await getUploadFileSignedURL(...);
// key is the identifier of the file in S3
const { uploadUrl, key } = data;
// upload the actual file using the signed URL, newFile here is the file selected in the form
await axios.put(uploadUrl, newFile);
...
}
(Source: Github Issue (open): Ability to serve and upload dynamic binary assets (images, pdfs) > Comments Part 1 (https://github.com/wasp-lang/wasp/issues/494)) If you're getting access denied errors, it's possible that there might be an issue with your AWS S3 bucket permissions or IAM user permissions. Make sure that your IAM user has the necessary permissions to access the S3 bucket and that your S3 bucket is configured correctly. If you're still having trouble, you might find it helpful to check out some of the resources mentioned in Github Issue (open): Ability to serve and upload dynamic binary assets (images, pdfs) > Comments Part 4 (https://github.com/wasp-lang/wasp/issues/494), which provide more detailed information on how to set up file uploading with AWS and React. I hope this helps! If you have any other questions, feel free to ask. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @đź•ł, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Ingvar20
Ingvar20•3mo ago
I'm having the same problem can anyone help?
miho
miho•3mo ago
@Vinny (@Wasp) one for you
Filip
Filip•3mo ago
I'll take care of it Hey @Ingvar20, can you share what kind of errors you are getting and where?
Ingvar20
Ingvar20•3mo ago
I’m having the same problem is this person above. After setting up an IMA user and creating an S3 bucket, when I go to the “security credentials”, I’m given a bunch of “don’t have access” errors all over the place which doesn’t allow me to create an access key
Ingvar20
Ingvar20•3mo ago
its stuck on this step
No description
Jorge
Jorge•3mo ago
As a workaround, I solved this by adding the "IAMFullAccess" policy. There are probably more fine-grained permissions to set. 🙂
Jorge
Jorge•3mo ago
Probably something similar
No description
Ingvar20
Ingvar20•3mo ago
Yup Ohhhh
đź•ł
🕳OP•3mo ago
that fixed the issue, thank you!
Jorge
Jorge•3mo ago
great 🙂
Filip
Filip•3mo ago
Yeah, AWS is a pain to set up. Glad you got it working! @Ingvar20 Thanks for reporting too, I'll try to recreate the documented steps and see what we need to add. And @Jorge thanks for jumping in with a workaround!
Ingvar20
Ingvar20•3mo ago
Thanks for the help! 🙂
Jorge
Jorge•3mo ago
@sodic you're welcome, glad to help
MEE6
MEE6•3mo ago
Wohooo @Jorge, you just became a Waspeteer level 2!
Want results from more Discord servers?
Add your server