Skip to content
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

deploying to bucket outside the default region us-east-1 fails with cryptic 301: null error #53

Closed
jm3 opened this issue Apr 1, 2015 · 16 comments

Comments

@jm3
Copy link

jm3 commented Apr 1, 2015

this is basically user error on my part, but forgetting to pass the AWS region in the config {} for non-us-east-1 buckets causes gulp-awspublish to die with a cryptic 301: null error. it would be nice if this error was more helpful, e.g.:

BUCKET NOT FOUND: please check your bucket name and AWS region

gulp-awspublish version:
% npm list | grep aws
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ │ ├── [email protected]
error:
% gulp deploy
[15:11:18] Starting 'deploy'...
[15:11:18] Finished 'deploy' after 4.1 μs
gulp-awspublish/node_modules/aws-sdk/lib/request.js:32
          throw err;
                ^
301: null
    at Request.extractError (gulp-awspublish/node_modules/aws-sdk/lib/services/s3.js:359:35)
    at Request.callListeners (gulp-awspublish/node_modules/aws-sdk/lib/sequential_executor.js:100:18)
    at Request.emit (gulp-awspublish/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (gulp-awspublish/node_modules/aws-sdk/lib/request.js:604:14)
    at Request.transition (gulp-awspublish/node_modules/aws-sdk/lib/request.js:21:12)
    at AcceptorStateMachine.runTo (gulp-awspublish/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at gulp-awspublish/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (gulp-awspublish/node_modules/aws-sdk/lib/request.js:22:9)
    at Request.<anonymous> (gulp-awspublish/node_modules/aws-sdk/lib/request.js:606:12)
  at Request.callListeners (gulp-awspublish/node_modules/aws-sdk/lib/sequential_executor.js:104:18)
@pgherveou
Copy link
Owner

sorry for the hassle
its quite hard for me to investigate these kind of connection issues
can you try to manually pushing a file
using aws (see https://github.com/pgherveou/gulp-awspublish/blob/master/lib/index.js#L402 for example)
and see if you get the same error too

@jm3 jm3 changed the title deploy to s3 bucket fails with 301: null deploying to bucket outside the default region us-east-1 fails with cryptic 301: null error Apr 3, 2015
@pgherveou
Copy link
Owner

Glad you found the error,
We should look into aws to see if we can get better error messages, or send them an issue, I don't think this plugin should be in charge of that.

@JamieDixon
Copy link

I ran into this same issue today also. It would help if there was mention of the region parameter in the README to let users know that they need to specify the region. I'm happy to send a pull request with that change if you're good with it.

@jm3
Copy link
Author

jm3 commented Apr 24, 2015

@JamieDixon good idea

@pgherveou
Copy link
Owner

PR are more than Welcome :)

Sent from my iPhone

On 24 avr. 2015, at 19:17, John Manoogian III [email protected] wrote:

@JamieDixon good idea


Reply to this email directly or view it on GitHub.

@alexgorbatchev
Copy link
Collaborator

We just pushed 2.0 out which takes straight S3 config options, so you are able to do quite a few other things like use a proxy. Do you think we still need to be explicit about the region in that case?

@jm3
Copy link
Author

jm3 commented Apr 28, 2015

when there are many possible AWS regions and the error for wrong region is
a cryptic 301, i think it makes sense to have a more instructive error so
the developer knows what's wrong.

On Tue, Apr 28, 2015 at 9:11 AM Alex Gorbatchev [email protected]
wrote:

We just pushed 2.0 out which takes straight S3 config options, so you are
able to do quite a few other things like use a proxy. Do you think we still
need to be explicit about the region in that case?

Reply to this email directly or view it on GitHub
#53 (comment)
.

@alexgorbatchev
Copy link
Collaborator

I just used an invalid bucket name for the test and got a pretty digestible error. Perhaps it was addressed on AWS side?

  gulp-awspublish
    1) "before all" hook

  0 passing (155ms)
  1 failing

  1) gulp-awspublish "before all" hook:
     NoSuchBucket: The specified bucket does not exist
      at _stream_readable.js:943:16

@jm3
Copy link
Author

jm3 commented Apr 29, 2015

try different region?
On Wed, Apr 29, 2015 at 6:26 AM Alex Gorbatchev [email protected]
wrote:

I just used an invalid bucket name for the test and got a pretty
digestible error. Perhaps it was addressed on AWS side?

gulp-awspublish
1) "before all" hook

0 passing (155ms)
1 failing

  1. gulp-awspublish "before all" hook:
    NoSuchBucket: The specified bucket does not exist
    at _stream_readable.js:943:16

Reply to this email directly or view it on GitHub
#53 (comment)
.

@hiattp
Copy link

hiattp commented May 4, 2015

@alexgorbatchev Using v2, got the same cryptic 301. Adding to the readme or changing the error would definitely still help.

@kretz
Copy link

kretz commented Jul 2, 2015

And for those who get this error and don't know how to specify the region:

  var publisher = $.awspublish.create({
    region: 'eu-west-1',
    params: {
      Bucket: '...'
    }
  });

@blaues0cke
Copy link

The region key for frankfurt is: eu-central-1.

@pachirel
Copy link

I encountered same error when I tried to upload wrong region.

I have a budget in us-west-2 region, but I specified ap-northeast-1 region.
To fix it, remove existing budget and create new one in correct region or specify correct region.

code example:

AWS = require('aws-sdk')
credentials = new AWS.SharedIniFileCredentials({profile: 'your-profile-name'})
AWS.config.credentials = credentials
AWS.config.region = 'region-the-budget-exists'
publisher = awspublish.create({
  params: {
    'Bucket': 'your-budget-name'
  }
})

@wembernard
Copy link

Thank you @kretz :)

@thewillhuang
Copy link

man, wasted so much time on this. in my ~/.aws config, my region is set to us-west-2 but the gulp task woulden't work unless i specify it. /facepalm

@pgherveou
Copy link
Owner

Thanks for the issue and workaround.
Can you guys add any info that could help others in the Readme with a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants