fix: Make sure if header is set already, it isn't set again#12194
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
|
Current dependencies on/for this PR: This stack of pull requests is managed by Graphite. |
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
f64f6c8 to
0091ecf
Compare
| const result = await f(req, res); | ||
| ok = true; | ||
| if (result) res.json(result); | ||
| if (result && !res.writableEnded) { |
There was a problem hiding this comment.
There could be cases where header is already set and result is also set. e.g. res.redirect unlike res.json returns a non nullish value and thus we would endup setting json in that case as well which would cause 'header already set error'
So, we should set this json if something isn't already written to the stream.
There was a problem hiding this comment.
Nice find. Unit testable (could be follow up)?
📦 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✅ 251 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 11/02/2023 05:57:01am UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: ff4b6d3 Started: 11/02/2023 05:53:10am UTC
|
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
2FA Tests should allow a user to enable 2FA and login using 2FA
Retry 1 • Initial Attempt |
0.39% (1)1 / 255 runfailed over last 7 days |
33.73% (86)86 / 255 runsflaked over last 7 days |
📄 apps/web/playwright/booking-pages.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
pro user Time slots are not reserved when going back via Cancel button on Event Form
Retry 1 • Initial Attempt |
0.46% (1)1 / 216 runfailed over last 7 days |
0.46% (1)1 / 216 runflaked 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 Can book a paid booking
Retry 1 • Initial Attempt |
2.64% (7)7 / 265 runsfailed over last 7 days |
3.40% (9)9 / 265 runsflaked over last 7 days |
📄 apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Booking With Address Question and Each Other Question Booking With Address Question and Short text question Address and Short text not required
Retry 1 • Initial Attempt |
0% (0)0 / 186 runsfailed over last 7 days |
2.15% (4)4 / 186 runsflaked over last 7 days |
📄 apps/web/playwright/event-types.e2e.ts • 1 Flake
Test Case Results
| Test Case | Last 7 days Failures | Last 7 days Flakes |
|---|---|---|
|
Event Types tests user Different Locations Tests Can remove location from multiple locations that are saved
Retry 1 • Initial Attempt |
0% (0)0 / 253 runsfailed over last 7 days |
7.11% (18)18 / 253 runsflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 2 Flakes
Top 1 Common Error Messages
|
|
2 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 |
2.92% (8)8 / 274 runsfailed over last 7 days |
51.82% (142)142 / 274 runsflaked over last 7 days |
|
Popup Tests should be able to reschedule
Retry 2 • Retry 1 • Initial Attempt |
20.07% (55)55 / 274 runsfailed over last 7 days |
77.01% (211)211 / 274 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 Can create a private team
Retry 1 • Initial Attempt |
0% (0)0 / 178 runsfailed over last 7 days |
14.61% (26)26 / 178 runsflaked over last 7 days |
| const result = await f(req, res); | ||
| ok = true; | ||
| if (result) res.json(result); | ||
| if (result && !res.writableEnded) { |
There was a problem hiding this comment.
Nice find. Unit testable (could be follow up)?


What does this PR do?
Fixes the following error. Though as far as I tested, the error arises only when there was already an error in the callback endpoint
In case of zohocalendar, the error was coming when this line was executed https://github.com/calcom/cal.com/blob/0091ecf572c063e899ec664e2e3f6aa6e1c6499c/packages/app-store/zohocalendar/api/callback.ts#L58. It returned a non nullish value causing the bug in
defaultResponder.Type of change
How should this be tested?
Mandatory Tasks
Checklist