-
Notifications
You must be signed in to change notification settings - Fork 23
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
No nodes created by this plugin #332
Comments
Hey @nanorepublica! Sorry to hear you’re having trouble. Happy to help debug — I regularly test this source plugin with both private S3 buckets for my prod site, and a self-hosted minio bucket when developing locally just to speed things up a bit… plus I make liberal use of lodash / promises etc., so I’m confident we can this working for you :) Here’s what jumps out to me: how are you authenticating to your private bucket? I don’t see the const AWS = require('aws-sdk')
AWS.config.update({
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_KEY_ID,
})
// ^ This is the key part!
module.exports = {
plugins: [
// …
{
resolve: 'gatsby-source-s3-image',
options: { bucketName: 'my-private-bucket' },
},
],
} You can read up on other AWS authentication options around their docs here, but I’ve never had any problems with the Hope this helps — let me know if this gets you going, so I can update the documentation to be more explicit re: authentication requirements. If not: it’d be helpful to see the relevant portion(s) of your Cheers, |
I do have that in my config (see below) and no luck :(
It would seem that Could you share an example of your AWS IAM policy for your user as that is the only other thing that I could see being a configuration issue? |
a quick update from me. It is definitely a permissions issue. Looking at your package.json from your site I had an outdated gatsby version. Updating this led to a very clear HTTP 403 error message for my images. It would be great to see an example of an IAM S3 policy for a user. |
Accounts for AWS’ requirement that buckets created outside of `us-east-1` **post** 2019-03-20 cannot be referenced via the `s3.amazonaws.com` virtual host. (Hopefully?) fixes #332. > You can use this client [s3.amazonaws.com] to create a bucket in any AWS > Region that was launched until March 20, 2019. To create a bucket in > Regions that were launched after March 20, 2019, you must create a > client specific to the Region in which you want to create the bucket. > For more information about enabling or disabling an AWS Region, see AWS > Regions and Endpoints in the AWS General Reference. > [...] > Buckets created in Regions launched after March 20, 2019 are not > reachable via the https://bucket.s3.amazonaws.com naming scheme. Source: https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html Signed-off-by: Jesse Stuart <[email protected]>
Dope, that helps to clarify the issue. Not sure if this affects you — I noticed your profile shows you’re UK based — but I did some investigating over the weekend and discovered a bug with how the AWS SDK handles S3 buckets created not in Re: the S3 policy 403 errors — yeah, I’ve seen that too while testing. Take a look at AWS’ policy generator, a bare-bones webapp for generating the policy JSON based on a few inputs. Here’s an example policy that I got working for a Gatsby site using an EU-based bucket: {
"Version": "2012-10-17",
"Id": "Policy1562526525963",
"Statement": [
{
"Sid": "Stmt1562526522757",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::js-london-test/*"
}
]
} (screenshot of where this is configured in the AWS console) Note: the wildcard principal effectively makes the bucket object publicly accessible, given the URL (thus no more 403’s); there’s definitely a way to lock this down (e.g., specifying an individual IAM user as principal) but that’s not something I’ve tested since in all my use cases the images end up public regardless. TL;DR:
Hope this helps! Keep me posted how you get on with this. |
Well, if you set the principal as
I tried to set the principal in my bucket policy as my user, but I keep getting 403s. In my case I also don't mind my bucket being public, but still it would be nice to document how to make a bucket private while working with this plugin 🙂 |
@robinmetral I have just opened PR #339 which should allow private buckets to be used. It is still a work in progress right now, but the basics look to be working for me. |
I really want to use this plugin (or any working plugin to source S3) but I've been trying for a month and can't get over the issue here. I'm located in New York, my bucket is private, and I am seeing Correspondingly, when I try a page query on the node supposedly created, I see an the error: I update my aws configuration itself (even though it's already configured in my
My query in
And I don't see allS3Image listed under nodes in I include it directly in the plugins within
I'm using the latest version of this plugin, and the latest version of Gatsby. |
I'm not using TypeScript -- could that be the issue? I have also tried using http vs. https (working on localhost) |
Hi @rahul-nath, I was working on the PR above, but other priorities and that I hit an issue I couldn't get my head around with Gatsby has prevented me from continuing to work on it.
The idea behind the PR above was to generate temporary URLs during the build process for the source plugin to get the image, do the local processing and then present the data to gatsby.
Therefore I would suggest crafting a bucket policy that allows the images you want to pull from your S3 bucket public. For an initial bucket policy see the comment above (#332 (comment)) |
@rahul-nath lucky timing, I'm actually building private bucket support into I agree with @nanorepublica above that private bucket support is not a huge priority, since it's likely that the images will be publicly accessibly online anyways, but it's still a nice feature just because S3 buckets are private by default - so supporting them removes one config step. For context, I made this other S3 source plugin because I needed it, and both other community plugins are not actively maintained anymore. Happy to help with any issues over there 🙂 |
@robinmetral I actually started using your plugin yesterday! I really like its simplicity, haven't had trouble with public images. |
Hi there,
I am trying to use this plugin with a private S3 bucket to download (& display) about 350 photos. However, I am currently getting the following warning message whenever I run
gatsby develop
.My first impression was that I had a permissions problem, but some searching around revealed this issue comment ((gatsbyjs/gatsby#12848 (comment)) on the main gatsby repo, which points to a problem between lodash and promises.
I fully accept that it is likely my code/config that is the issue so any insight into what I might be doing wrong would be appreciated.
My package.json is as follows:
The text was updated successfully, but these errors were encountered: