-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cypress.run module api throws "Error running proxy middleware: Cannot call this.next() more than once in the same middleware function." #22825
Comments
@JohnnyFun in order to properly investigate this, it would be helpful if you could share either a repo containing an example spec or a simplified code snippet that helps us to replicate the issue internally. |
I'm trying to reduce it down to simplest scenario.
One thing I noticed is that it uses the devServer webpack port from my If it rings any bells, the error that |
I'll try to get a repo or PR that resolves the issue. Worst case scenario, I'll just run my component tests with a single cypress.run call for now. |
Maybe related, but what is |
Getting closer. It's an error in the error handling code, so the underlying issue was hidden, which was:
at this line:
|
I confirmed that if I null check that Let me know if you need anything else from me to resolve this one. |
I'm not sure if a null check is the correct resolution of course--just wanted to find a work around for me in the meantime. I'm not very familiar with the cypress codebase, so not sure if the component server class also needs a file server for something or not. Also, the error handling code should probably be fixed to not get that original |
In the meantime, I'll work around with this silly hack that just rewrites the file before running
|
Thanks for debugging through this @JohnnyFun. I'm also experiencing this same issue. It only started once we upgraded to Here is one example failure: |
Yep, same--my codebase was on latest cypress9.x and moving to 10.3. But yeah, my code from above should get you going for now at least--i.e. just putting a null check on that property in the cypress code. It also works if you just comment out that |
Though if neither of those work for you, you might need to console.log or put a breakpoint in the initial |
Hey @JohnnyFun, Thanks for the investigation. I think you're on to something! Would it be possible for you to put together a recreate-able repo for me? That will allow us to verify any fix we implement. Generally, when I'm making reproduction I |
Yar: https://github.com/JohnnyFun/cypress-issue-22825 Seems to be due to a component that calls |
Let me know if the error doesn't happen for you on your machine. I was honestly surprised I was able to simplify it down that much. Another potentially related thing I noticed is that it won't run if |
@JohnnyFun, thanks for the reproduction. I am able to see the issue on my machine as well. |
Sweet, glad I could help. Long live Cypress! |
Hey team! Please add your planning poker estimate with Zenhub @amehta265 @astone123 @lmiller1990 @marktnoonan @mike-plummer @rockindahizzy @warrensplayer @ZachJW34 |
Hi, has this been resolved pls? Am facing the same issue, but cant track it down as @JohnnyFun ... dont have any of the specified stuff on my project as for example "getFileServerToken" etc. Any ideas how to proceed? |
also checking in on progress here as we're seeing it on e2e and component tests. With one e2e test in particular we're seeing it happen because of a specific cy.intercept call. We are mocking the response after it comes back from the BE before it hits the browser. We're doing this with another call just before and that seems to not cause the issue. The only difference is the one with the issue has a forEach (we also tried changing it to a regular for loop but it still failed). It's causing the error listed here to occur on a random other spec, a different one each time. We are running all the tests in parallel when this occurs. |
Hi @Vik0411 and @ccannawright . I'm taking a look at this issue this week. The reproduction @JohnnyFun provided identified an error-handling issue specific to component tests that I'll be plugging, but if either of you have a reproduction case or a full Debug log you could share of this occurring in an e2e test that would be super helpful since there are likely other situations where we're inappropriately looping in our middleware error handling code |
Improvements to error handling in this area will be included in our next release. The specific error case identified in the attached component testing reproduction has been fixed, and for any other lingering cases additional logging has been added to report a more meaningful error. I was unable to reproduce this error in an e2e test against v12.5.1, but if this is encountered in the future it can be logged as a new issue with the supplemental logs to help us track down the root cause |
Cool, at some point soon I'll confirm that removing my work around passes. Thanks! |
@mike-plummer Hi, when can we expect this to be released? We have a lot of tests failing due to this issue. |
This will be in the next release, 12.6, which is this week. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Hi @matys84pl, when you get a moment please confirm that this fixed your issue. |
Current behavior
Running multiple
cypress.run
module api commands on the same machine might be the cause.It seems to be a race condition, so it doesn't happen every time.
Desired behavior
No response
Test code to reproduce
If the stack trace above doesn't lead you directly to what's up, let me know and I can setup a repo that'll call
cypress.run
like 5 times and hopefully reproduce the error consistently.Cypress Version
10.3.0
Other
No response
The text was updated successfully, but these errors were encountered: