-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix: properly pass req.user to liveQuery triggers #7296
Conversation
Can you write a test case? Looks good |
Codecov Report
@@ Coverage Diff @@
## master #7296 +/- ##
=======================================
Coverage 93.91% 93.92%
=======================================
Files 181 181
Lines 13195 13210 +15
=======================================
+ Hits 12392 12407 +15
Misses 803 803
Continue to review full report at Codecov.
|
Tests for this seem to be very flaky. Not sure why. Sometimes sesssionToken is passed, sometimes it's not. I think it's possibly because client is cached across request by the JS SDK. Any pointers appreciated! Test also work with |
@mtrezza @davimacedo just noting that this will have to be solved before next release otherwise LQ triggers won’t have .user available to them |
This is usually an indication that the test is influenced by other tests that run previously. It may have to do with the recent restructuring of tests. It may also be that your added tests influence each other when not run with |
I just noticed that this is a PR and it doesn't seem to have a referenced open issue. @dblythy How is this PR and your finding related to the issue #7295, which has been closed by the author who wrote that the issue was just a misconfiguration. If this is unrelated to the issue, can you please open a new one and correct the reference? |
I discovered this bug during the investigation for #7295, and I assumed that this was the bug that @yanuarizalk had found. It appears now that it wasn't. I've reopened an issue. |
Generated by 🚫 dangerJS |
New Issue: #7318 |
Thanks, so we can apply the bug label and remind us to address this before new release. |
Should be good to go. Do you want me to add a changelog? This bug was introduced in the master and fixed in the master so I don't see the purpose of the changelog imo. |
Yes, I also think no changelog entry is necessary. Are the tests still flaky? |
Nope! The issue was using It seems as though |
Could you look at the codecov? It says some added lines are not covered by tests. |
517d050
to
89345ad
Compare
Getting an error:
Any pointers appreciated! |
await object.destroy(); | ||
await new Promise(resolve => setTimeout(resolve, 200)); | ||
for (const key in calls) { | ||
expect(calls[key]).toHaveBeenCalled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever!
I restarted the test to make sure it's not just flaky - it still occurs. My guess, it's probably the refactoring of the auth object in this PR. Did you try to debug step through the test? |
The master branch passes currently, it could be flaky? I just restarted the jobs on master, let's see. Edit: You were right, same error on master, even though the build passed 3 days ago. Maybe something has changed externally. There was likely a change in the Twitter API, as you said the test checks an endpoint. It's possible that the test points to an obsolete API version and it has been force-upgraded. I would just debug the test to get a hint why it fails. This should be fixed in a separate issue / PR though. |
The test performs a GET request on this url, which now returns an empty page. I'm assuming this is a change on Twitter's end. The test is expecting a response of Will create a new issue and PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for fixing this.
Thank you for the review Manuel! |
🎉 This change has been released in version 5.0.0-beta.1 |
🎉 This change has been released in version 5.0.0 |
New Pull Request Checklist
Issue Description
When I replaced the LQ triggers auth lookup with
getAuthForSessionToken
, I forgot to destructure auth. My bad.This results in req.user always being undefined for LQ triggers. This only affects the master branch.
First commit is failing test.
Closes: #7318