Problems deploying to AWS S3

Hey all!

I just finished building my website through Hugo, and I’m loving it so far. However, I’m having issues deploying my static Hugo site to my AWS S3 bucket. I’m using the Hugo Deploy command. I’ve followed the linked documentation, configuring the AWS bucket, CLI, and Admin user credentials according to the Amazon docs. After building my site, I used the deploy command to put it into my AWS bucket. Instead, I am getting the following error:

Deploying to target "aws-bucket" (s3://bucket-name?region=us-east-2)
  Error: blob (code=Unknown): NoCredentialProviders: no valid providers in chain. Deprecated.
	 For verbose messaging see aws.Config.CredentialsChainVerboseErrors

I thought that this indicated some kind of error with my AWS credentials, so I made sure that I have read-access, and tried again (same error). Then, I removed the IAM user and created a new Admin user, but I’m receiving the same error.

Now, I think that it’s related to my CLI configuration or my bucket configuration, but I’m not sure. I’m new to AWS, so if anyone could advise me about deploying to a S3 bucket or AWS configuration, I’d really appreciate the help.

Hey,

Even if I know AWS S3 pretty well, I’m not intimate with Hugo’s implementation; but from the error I’m guessing the problem is on your side. How do you provide the credentials? Looking at the documentation now, I’ll admit that that part looks a little limiting (it mentions enviromnent variables, but not what they are called, i assume it’s the standard AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY ).

Hey!

Looks like hugo’s deploy function uses the GO CDK (this was linked on the Hugo Deploy doc). It says:

if you have authenticated with the AWS CLI, it will use those credentials.

If I’m understanding this right, I should just have to use the aws configure command to authenticate Hugo’s Deploy command. Or perhaps there’s a step I missed with the AWS CLI.

You are writing about “read access” but what you need is WRITE access and the way I read the error you have no writing rights.

I don’t see if you tried your deployment with -verbose parameter. If not, try that and let’s see what else comes out.

After changing my .aws directory to allow write access, I ran “hugo deploy” with the --verbose flag. Got the same error in the end, here’s what else came out:

hugo deploy --verbose
INFO 2019/12/27 08:57:08 No translation bundle found for default language "en"
INFO 2019/12/27 08:57:08 Translation func for language en not found, use default.
INFO 2019/12/27 08:57:08 i18n not initialized; if you need string translations, check that you have a bundle in /i18n that matches the site language or the default language.
INFO 2019/12/27 08:57:09 Using config file: 
Deploying to target "aws-s3" (s3://aws-bucket?region=us-east-2)
INFO 2019/12/27 08:57:09 Found 83 local files.
Error: blob (code=Unknown): NoCredentialProviders: no valid providers in chain. Deprecated.
	For verbose messaging see aws.Config.CredentialsChainVerboseErrors

Additionally, I can’t seem to find the indicated error file “aws.Config.CredentialsChainVerboseErrors”.

Thoughts? I still think that there’s some issue with the Go Cloud API (that Hugo uses for deployment) accessing the AWS credentials.

I don’t think aws.Config.CredentialsChainVerboseErrors is a file. It looks like a command in some SDK that can be used to retrieve more verbose errors.

It seems that the way you are providing the credentials is “deprecated”. I would open an issue in Hugo’s github repo.

I had this as well and pulled from master and built hugo locally (with go1.14…). That worked.