metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

[Bug]: AWS upload not working - metaplex v2 #1849

Closed MoMannn closed 2 years ago

MoMannn commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

I am trying to upload assets to aws. I set the correct bucket and storage in the config.

The upload goes through and the validate upload as well. But not assets are actually uploaded to the bucket. There are no errors. The bucket is set to public and correct aws keys are used.

I believe this is a high priority issue since I cannot launch a collection.

Command

AWS_ACCESS_KEY_ID=MY_KEY AWS_SECRET_ACCESS_KEY=MY_SECRET \
ts-node ./js/packages/cli/src/candy-machine-v2-cli.ts upload \
    -e devnet \
    -k ~/.config/solana/id.json \
    -cp config.json \
    -c example4 \
    ./assets

Relevant log output

Uploading Size 10 { mediaExt: '.png', index: '0' }
Processing asset: 0
Processing asset: 1
Processing asset: 2
Processing asset: 3
Processing asset: 4
Processing asset: 5
Processing asset: 6
Processing asset: 7
Processing asset: 8
Processing asset: 9
Writing indices 0-9
Done. Successful = true.

Key size 10
Looking at key  0
Looking at key  1
Looking at key  2
Looking at key  3
Looking at key  4
Looking at key  5
Looking at key  6
Looking at key  7
Looking at key  8
Looking at key  9
uploaded (10) out of (10)

Operating system

mac os

Priority this issue should have

High (immediate attention needed)

Check the Docs First

codebender828 commented 2 years ago

Experiencing this as well.

MoMannn commented 2 years ago

Any progress on this? I find this quite critical...

joze144 commented 2 years ago

I also had an issue with it, fixed it by changing AWS region. By default it always uses us-east-1, and there are only debug logs if upload fails. So it's hard to know what is the issue

Can find this piece of code in aws.ts and change region, which is hardcoded

export async function awsUpload(
  awsS3Bucket: string,
  image: string,
  animation: string,
  manifestBuffer: Buffer,
) {
  const REGION = 'us-east-1'; // TODO: Parameterize this.
MoMannn commented 2 years ago
awsUpload

This didn't fix it for me. Tried creating a new bucket on us-east-1 and use that one and still not working.

Does the upload work for you on the v2 metaplex?

MoMannn commented 2 years ago

Finally able to fix this.

In the uploadFile function this log should be changed to info so that you can get the error:

 try {
    await s3Client.send(new PutObjectCommand(mediaUploadParams));
  } catch (err) {
    log.debug('Error', err);
  }

The problem was that ACL has to be enabled. This not noted anywhere in the documentation.

I would recommend adding this to documentation + changing the log.debug to log.info in the catch.

holywend commented 2 years ago

I dont even find where to put my access key and secret key. tried to put it in the .env but couldnt find where they load it if it ever loaded at all. ideas?