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: With Credential Sync enabled, fix expired google calendar token handling - Refresh wasn't working #14788
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @hariombalhara and the rest of your teammates on Graphite |
86386b6
to
509a01f
Compare
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 315 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 04/29/2024 08:36:20pm UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: 36eb5ca Started: 04/29/2024 08:33:10pm UTC
|
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Event Types tests -- legacy user can add multiple organizer address
Retry 1 • Initial Attempt |
0% (0)0 / 232 runsfailed over last 7 days |
1.72% (4)4 / 232 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 9 Flakes
Top 1 Common Error Messages
|
9 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Popup Tests should open embed iframe on click - Configured with light theme
Retry 1 • Initial Attempt |
15.35% (37)37 / 241 runsfailed over last 7 days |
54.36% (131)131 / 241 runsflaked over last 7 days |
Popup Tests should be able to reschedule
Retry 1 • Initial Attempt |
-179.45% (-131)-131 / 73 runsfailed over last 7 days |
179.45% (131)131 / 73 runsflaked over last 7 days |
Popup Tests should open Routing Forms embed on click
Retry 1 • Initial Attempt |
-178.08% (-130)-130 / 73 runsfailed over last 7 days |
178.08% (130)130 / 73 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when no theme is configured through Embed API
Retry 1 • Initial Attempt |
-176.71% (-129)-129 / 73 runsfailed over last 7 days |
176.71% (129)129 / 73 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Booker Profile Page) with dark theme when configured with dark theme using Embed API
Retry 1 • Initial Attempt |
-176.71% (-129)-129 / 73 runsfailed over last 7 days |
176.71% (129)129 / 73 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe according to system theme when configured with 'auto' theme using Embed API
Retry 1 • Initial Attempt |
-176.71% (-129)-129 / 73 runsfailed over last 7 days |
176.71% (129)129 / 73 runsflaked over last 7 days |
Popup Tests Floating Button Popup Pro User - Configured in App with default setting of system theme should open embed iframe(Event Booking Page) with dark theme when configured with dark theme using Embed API
Retry 1 • Initial Attempt |
-176.71% (-129)-129 / 73 runsfailed over last 7 days |
176.71% (129)129 / 73 runsflaked over last 7 days |
Popup Tests should open on clicking child element
Retry 1 • Initial Attempt |
-163.64% (-36)-36 / 22 runsfailed over last 7 days |
163.64% (36)36 / 22 runsflaked over last 7 days |
Popup Tests prendered embed should be loaded and apply the config given to it
Retry 1 • Initial Attempt |
-176.71% (-129)-129 / 73 runsfailed over last 7 days |
176.71% (129)129 / 73 runsflaked over last 7 days |
📄 packages/app-store/routing-forms/playwright/tests/basic.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Routing Forms Seeded Routing Form Test preview should return correct route
Retry 1 • Initial Attempt |
0.42% (1)1 / 239 runfailed over last 7 days |
35.98% (86)86 / 239 runsflaked over last 7 days |
📄 apps/web/playwright/webhook.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
BOOKING_RESCHEDULED when rescheduling to a booking that already exists, should send a booking rescheduled event with the existant booking uid
Retry 1 • Initial Attempt |
10.43% (22)22 / 211 runsfailed over last 7 days |
34.12% (72)72 / 211 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/namespacing.e2e.ts • 4 Flakes
Top 1 Common Error Messages
|
4 Test Cases Affected |
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Namespacing Inline Embed Double install Embed Snippet with inline embed using a namespace
Retry 1 • Initial Attempt |
0% (0)0 / 228 runsfailed over last 7 days |
53.51% (122)122 / 228 runsflaked over last 7 days |
Namespacing Different namespaces can have different init configs
Retry 1 • Initial Attempt |
0% (0)0 / 226 runsfailed over last 7 days |
53.10% (120)120 / 226 runsflaked over last 7 days |
Namespacing Inline Embed Double install Embed Snippet with inline embed without a namespace(i.e. default namespace)
Retry 1 • Initial Attempt |
0% (0)0 / 228 runsfailed over last 7 days |
54.39% (124)124 / 228 runsflaked over last 7 days |
Namespacing Inline Embed Add inline embed using a namespace without reload
Retry 1 • Initial Attempt |
0.44% (1)1 / 228 runfailed over last 7 days |
53.51% (122)122 / 228 runsflaked over last 7 days |
📄 apps/web/playwright/teams.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Teams - NonOrg -- future Can create a booking for Round Robin EventType
Retry 2 • Retry 1 • Initial Attempt |
17.60% (44)44 / 250 runsfailed over last 7 days |
22.40% (56)56 / 250 runsflaked over last 7 days |
📄 apps/web/playwright/integrations-stripe.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Stripe integration Pending payment booking should not be confirmed by default
Retry 1 • Initial Attempt |
1.32% (3)3 / 227 runsfailed over last 7 days |
23.35% (53)53 / 227 runsflaked over last 7 days |
@@ -85,13 +85,15 @@ export default class GoogleCalendarService implements Calendar { | |||
this.credential = credential; | |||
this.auth = this.initGoogleAuth(credential); | |||
this.log = log.getSubLogger({ prefix: [`[[lib] ${this.integrationName}`] }); | |||
this.credential = credential; |
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.
It was a duplicate code line(of line 85)
} | ||
|
||
private async getMyGoogleAuthSingleton() { | ||
const googleCredentials = OAuth2UniversalSchema.parse(this.credential.key); | ||
if (this.myGoogleAuth) { |
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.
Simplified the code.
const { client_id, client_secret, redirect_uris } = await getGoogleAppKeys(); | ||
this.myGoogleAuth = this.myGoogleAuth || new MyGoogleAuth(client_id, client_secret, redirect_uris[0]); | ||
const googleCredentials = OAuth2UniversalSchema.parse(this.credential.key); | ||
this.myGoogleAuth = new MyGoogleAuth(client_id, client_secret, redirect_uris[0]); | ||
this.myGoogleAuth.setCredentials(googleCredentials); |
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.
Now setCredentials
is also called only the first time. As getMyGoogleAuthSingleton
can be called multiple times, we shouldn't set it again and again.
Rest of the code should ensure that setCredentials
is called when needed
where: { | ||
id: credential.id, | ||
}, | ||
data: { | ||
key: token, | ||
}, | ||
}); | ||
|
||
// Update cached credential as well | ||
this.credential.key = key; |
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.
This is important line which fixes the issue.
We update the token in DB. But in case of google-calendar there is a cached value here as well. We should keep it upto-date in case someone use this value.
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (04/29/24)1 reviewer was added to this PR based on Keith Williams's automation. |
0c69f7a
to
509a01f
Compare
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.
Tested credential syncing GCal w/o refresh_token
it's grabbing the new token and working as expected.
What does this PR do?
Fixes issue with refreshed access_token not being used when credential sync is enabled.
Note that the issue isn't replicable if the refresh_token is set. You have to delete the
refresh_token
to be able to replicate the issue(with credential sync enabled)Type of change
How should this be tested?
expiry_date
Use a past time here so that the token expiresapps/installed/calendar
here. On main, auto-refresh won't occur but in this branch it will occur.Mandatory Tasks
Tests
Working for tests in a follow-up PR. Hitting some issues with mocking. Need to figure that out.
Checklist