gizmo icon indicating copy to clipboard operation
gizmo copied to clipboard

Connecting to subscriber results in 404

Open dmacthedestroyer opened this issue 7 years ago • 1 comments

While trying to run the sqs-sub pubsub example, I keep encountering this error:

InvalidAddress: The address https://sqs.us-east-1.amazonaws.com/ is not valid for this endpoint. status code: 404, request id: 14c12121-5d1c-5583-a35d-73d68936cbf6dmcdonald@dmcdonald-mbp15:~/go/src/dmcdonald/pubsubspike/

This traces to the s.sqs.GetQueueUrl call. I tried calling this api method myself with the following code, and got success:

	cfg := aws.NewConfig().WithCredentials(
		awscredentials.NewEnvCredentials(),
	).WithRegion(region)
	sqsClient := sqs.New(session.New(cfg))
	if resp, err := sqsClient.GetQueueUrl(&sqs.GetQueueUrlInput{QueueName: &queueName}); err != nil {
		fmt.Printf("failed to get queue url: \n%v\n", err)
	} else {
		fmt.Println(resp)
	}

I'm using the same permissions, region and queuename with both the gizmo example and my own test code.

The error response indicates possibly a permissions issue, but I can't seem to reproduce it outside of the gizmo codebase. Any suggestions on how to troubleshoot this further?

dmacthedestroyer avatar Feb 09 '18 17:02 dmacthedestroyer

I came across the same issue with the example code and you're correct that it is to do with permissions and how this is handled in the example code base.

Firstly, you'll either want to remove the AccessKey and SecretKeyfrom the config.json. In my opinion these should either be handled byawsclior through the envars:AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEY`. Checkout this page for more info about handling AWS credentials.

Secondly, you'll need to add your AccountId to config.json. e.g.: "QueueOwnerAccountId":"123456789012"

This worked for me so hopefully will help.

DavyJ0nes avatar Sep 17 '18 10:09 DavyJ0nes