question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deployment failing with AccessDenied

See original GitHub issue

Hi,

I’ve tried to follow all the instructions correctly, but am still unable to deploy to a test project.

My gatsby-config.js includes the bucketName, region and acl

module.exports = {
  plugins: [
    {
        resolve: `gatsby-plugin-s3`,
        options: {
            bucketName: 'hello-world-gatsby-unique',
            region: 'eu-west-3',
            acl: null
        },
    },
  ]
}

I created an IAM account for the project with an AmazonS3FullAccess policy — taking the advice that this was the easiest (but not best) way from this comment.

iam_user

I then created a bucket

S3-listing-with-bucket

With no blocking of public access (for now).

s3-block-public-access-off

I’m not using an Access Control List, instead setting up a Bucket Policy, taken from the advice in this comment.

s3-bucket-policy

I’ve also set up the Static website hosting with index and error documents to index.html and 404.html respectively.

After signing into the the AWS CLI using

aws configure

with the Access Key ID and Secret Access Key

I can manually upload a file to the bucket with a command like this

aws s3 cp README.md s3://hello-world-gatsby-unique/README.md

But running yarn run deploy gives me this error

$ gatsby-plugin-s3 deploy
✖ Failed.
  AccessDenied: Access Denied
  
  - s3.js:585 Request.extractError
    [hello-world]/[aws-sdk]/lib/services/s3.js:585:35
  
  - sequential_executor.js:106 Request.callListeners
    [hello-world]/[aws-sdk]/lib/sequential_executor.js:106:20
  
  - sequential_executor.js:78 Request.emit
    [hello-world]/[aws-sdk]/lib/sequential_executor.js:78:10
  
  - request.js:683 Request.emit
    [hello-world]/[aws-sdk]/lib/request.js:683:14
  
  - request.js:22 Request.transition
    [hello-world]/[aws-sdk]/lib/request.js:22:10
  
  - state_machine.js:14 AcceptorStateMachine.runTo
    [hello-world]/[aws-sdk]/lib/state_machine.js:14:12
  
  - state_machine.js:26 
    [hello-world]/[aws-sdk]/lib/state_machine.js:26:10
  
  - request.js:38 Request.<anonymous>
    [hello-world]/[aws-sdk]/lib/request.js:38:9
  
  - request.js:685 Request.<anonymous>
    [hello-world]/[aws-sdk]/lib/request.js:685:12
  
  - sequential_executor.js:116 Request.callListeners
    [hello-world]/[aws-sdk]/lib/sequential_executor.js:116:18
  

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

To make sure it wasn’t a unique name issue I tried to make sure with the long bucket name.

I feel like I must have missed something, but not sure what.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jarizcommented, Aug 13, 2019

Argh those permissions are so frustrating. This is the reason we don’t have an official document yet, because everyone says something different. I also absolutely hate the vague error AWS throws.

@JoshuaWalsh any ideas?

0reactions
jarizcommented, Jul 23, 2020

We should probably create a issue to document all permissions. This issue however, is not the place.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Software Installation Failure - Access denied to Deploy Software
Steps to follow when software installation fails when access is denies to deploy software applications.
Read more >
TN - 1277 Platform Fails to Deploy with Access Denied
The platforms failed to deploy for Windows 10 workstations only. An access denied message was found in the SMC Log Viewer.
Read more >
Deploy step in pipeline build fails with access denied
The CDK deploy seems to be ok and the build starts of fine. But then, the step DeployAlpha fails with. Access Denied (Service:...
Read more >
How do I resolve Access Denied error when trying to deploy ...
An internal failure occurred while running MSBuild. System.ComponentModel.Win32Exception (5): Access is denied. at System.Diagnostics.Process.
Read more >
Deployment fails "site: Access Denied" · Issue #6 - GitHub
Whenever I try to deploy to Prod, the site component fails with an Access denied error, while everything works fine for Dev.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found