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.

Slow computations in mathematical AWS cognito token generation

See original GitHub issue

What is your Test Scenario?

I’m using AWS JS Cognito API to login

What is the Current behavior?

The computation of the authentication token is taking extremely long 8 seconds when it’s over in < 1 second without testcafe. I’ve tracked down the offending function in AWS BigInteger modPow method: https://github.com/aws-amplify/amplify-js/blob/master/packages/amazon-cognito-identity-js/src/BigInteger.js#L685

What is the Expected behavior?

Testcafe execution doesn’t take a lot more time than execution without testcafe.

What is your web application and your TestCafe test code?

I’m sorry I cannot give you access to my web app currently and I haven’t reduced the problem to an example yet. It requires an AWS account or I would have to mock it for a test.

Steps to Reproduce:

Again, sorry there are no steps to reproduce yet. I’ll provide them if it turns out that this is surprising behavior that computations are much slower…

Your Environment details:

  • testcafe version: 1.1.0
  • node.js version: 10.15.2
  • command-line arguments: testcafe -e ‘chrome’ src/testcafe -S -s screenshots -f ‘SignedIn Client Route Tests’
  • browser name and version: Chrome 72.0.3626 /
  • platform and version: macOs 10.14.3
  • other: tests are written in Typescript (while amazon’s Cognito/BigInteger code isn’t)

Here’s a Chrome profile from a testcafe run that shows that a lot of time is spent in bnModPow: testcafe_slow_sign-in.json.zip

And here’s a Chrome profile from a run without testcafe that is spending significantly less time overall and especially in the token generation and bnModPow method: without_testcafe_fast_sign-in.json.zip

Both profiles were created manually during the sign-in.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Farfurixcommented, May 14, 2020

@vsorrokin

Hello,

Thank you for the example. We’ll take it into account.

We use key encrypting/decrypting in my project at most of operations which makes testing flow really slow because of this hammerhead problem.

Also can you please tell how to develop testcafe-hammerhead and help you?

Our team need to examine the issue locally.

I mean you have instruction how to run playground but how to develop with changes watching, live reloading or HMR? For now I can’t even modify built hammerhead.js and see changes in browser after manual reloading.

You need to restart the http-playground Gulp command after you make any changes in testcafe-hammerhead. If you are monitoring the changes in your TestCafe test file, I suggest you follow these steps: Note: both repositories may have cross changes; that is why, you need to downgrade to the latest released version.

  1. Clone the testcafe repository and create a branch based on the latest non-rc/alpha version, for example: v1.8.4.
  2. Clone the testcafe-hammerhead repository. You can find a suitable version in ./package.json of your testcafe branch, for example, "testcafe-hammerhead": "16.2.3". Create a branch based on the v16.2.3 tag.
  3. Link your testcafe-hammerhead local branch to your testcafe local branch.
  4. Make necessary changes in the testcafe-hammerhead local branch and run the gulp build command.
  5. Run the testcafe local branch with your testcafe-hammerhead changes: node bin/testcafe chrome ./some-test.js.
0reactions
github-actions[bot]commented, May 25, 2021

We’re closing this issue after a prolonged period of inactivity. If it still affects you, please create a new issue with up-to-date information. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre token generation Lambda trigger - Amazon Cognito
You can use this AWS Lambda trigger to customize an identity token before Amazon Cognito generates it. You can use this trigger to...
Read more >
How to Use Cognito Pre-Token Generation trigger to ... - AWS
In this post we will talk about how to add custom JWT claims to an ID Token generated by a Cognito User Pool...
Read more >
Metrics for Amazon Cognito user pools
Provides the total number of throttled requests to refresh an Amazon Cognito token that were made to the Amazon Cognito user pool.
Read more >
Quotas in Amazon Cognito
This elevated quota accommodates multiple authentication challenges set up in developers' apps. The quota is sufficient to cover the large majority of use...
Read more >
User pool authentication flow - Amazon Cognito
The app calls the RespondToAuthChallenge operation. If the call succeeds, Amazon Cognito returns the user's tokens, and the authentication flow is complete.
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