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

Error when generating using sigV4Client #114

Open
CharithW opened this issue Jul 21, 2017 · 18 comments
Open

Error when generating using sigV4Client #114

CharithW opened this issue Jul 21, 2017 · 18 comments

Comments

@CharithW
Copy link

I am getting following error when trying to access api gateway through federated identities.
This is the error I am getting

TypeError: __WEBPACK_IMPORTED_MODULE_2__sigV4Client__.a.newClient(...).signRequest is not a function at _callee$ (http://localhost:3001/static/js/bundle.js:205699:10) at tryCatch (http://localhost:3001/static/js/bundle.js:195602:40) at Generator.invoke [as _invoke] (http://localhost:3001/static/js/bundle.js:195840:22) at Generator.prototype.(anonymous function) [as next] (http://localhost:3001/static/js/bundle.js:195654:21) at step (http://localhost:3001/static/js/bundle.js:205663:191) at http://localhost:3001/static/js/bundle.js:205663:361 at <anonymous>

Any workarounds are much appreciated :)

@jayair
Copy link
Contributor

jayair commented Jul 21, 2017

@CharithW It seems like importing the sigV4Client failed. Can I see your awsLib.js and sigV4Client.js?

@dailenspencer
Copy link

@CharithW @jayair Any luck on this? i'm having the same issue in my app.

@jayair
Copy link
Contributor

jayair commented Oct 21, 2017

@dailenspencer
Copy link

dailenspencer commented Oct 22, 2017

@jayair

sigV4Client.js is identical. My application is being used differently than this tutorial's purpose so its hard to compare awsLib.js to my file. I've added you as a collaborator to the project. If you want, take a look at helpers/aws/index.js <- this is the only other file thats calling the aws functions in a similar fashion. The error only occurs every so often :/

@jayair
Copy link
Contributor

jayair commented Oct 22, 2017

@dailenspencer Hmm I don't see the invite for some reason. Can you check the version of react-scripts in your package.json?

@dailenspencer
Copy link

@jayair I dont have react-scripts in my package.json. Adding that now and will update you. Here is the invite link

https://github.com/dailenspencer/Element/invitations

@dailenspencer
Copy link

react-script installation didnt have an effect

@bencarlson
Copy link

bencarlson commented Nov 11, 2017

I'm receiving a similar error:

TypeError: WEBPACK_IMPORTED_MODULE_3__sigV4Client.a.newClient(...).signRequest is not a function

I've confirmed that my awsLib.js and sigV4Client.js are identical to the source in github. This issue seems to only occur upon login. If I reload the page (hard refresh) the homepage with items renders just fine. I'm guessing it has something to do with the proximity of the AWS call to Lambda, and the login/authentication?

@sanjosedennis7593
Copy link

Any update on this issue?

@jayair
Copy link
Contributor

jayair commented Nov 26, 2017

We might have found a culprit here - #113 (comment)

I'm looking into a proper solution but in the mean time, there is a quick workaround in that comment.

@jayair
Copy link
Contributor

jayair commented Dec 4, 2017

We are unable to replicate this issue with the version of the code in tutorial. Here is more info on this - #113 (comment)

If somebody has been able to replicate it, I'd like to take a look.

@markuspelnens
Copy link

You can reproduce it in IE11, and it is caused by line 231:

let parser = new URL(awsSigV4Client.endpoint);

IE11 doesn't support the URL interface. I fixed it by setting a host entry directly in config.js and then passing it as an argument to the sigV4Client client:

	const signedRequest = sigV4Client
		.newClient({
			accessKey: AWS.config.credentials.accessKeyId,
			secretKey: AWS.config.credentials.secretAccessKey,
			sessionToken: AWS.config.credentials.sessionToken,
			region: config.apiGateway.REGION,
			endpoint: config.apiGateway.URL,
			host: config.apiGateway.HOST
		})

and then setting the header in sigV4Client.js directly:

    //let parser = new URL(awsSigV4Client.endpoint); Removed for IE 11 Compatability
    headers[HOST] = awsSigV4Client.host

@jayair
Copy link
Contributor

jayair commented Dec 11, 2017

@markuspelnens Oh interesting. I'm not sure if this is the same issue other folks are having but let me take a look into it. Thanks for digging into it.

@jayair
Copy link
Contributor

jayair commented Jan 1, 2018

@markuspelnens I've updated the sigV4Client.js to fix this. So we aren't using the URL object.

https://github.com/AnomalyInnovations/serverless-stack-demo-client/blob/master/src/libs/sigV4Client.js

@markuspelnens
Copy link

Great! Was it also the cause for the issue other people were having?

@jayair
Copy link
Contributor

jayair commented Jan 3, 2018

@markuspelnens I'm not entirely sure, it's been really hard to track down.

@forste
Copy link

forste commented Jan 6, 2018

I had the same issue.
It's also logged here: AnomalyInnovations/serverless-stack-demo-client#17 and here #113.
fcostarodrigo found a work-around here: #113 (comment)

@jayair
Copy link
Contributor

jayair commented Jan 8, 2018

@forste Are you able to replicate it reliably? Does it happen every time for you? If so can you share your repo, I'd like to test it and fix it.

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

7 participants