Skip to content
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

perf: Do not import Stripe lib in getServerErrorFromUnknown #19578

Merged
merged 9 commits into from
Feb 27, 2025

Conversation

hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Feb 26, 2025

What does this PR do?

two reasons for this PR:

  1. When we run functions or routes in Edge where we use getServerErrorFromUnknown, importing stripe lib throws an error because it's incompatible with the Edge Runtime due to its reliance on Node.js-specific APIs like crypto and http
  2. Stripe lib was used only for type check in getServerErrorFromUnknown

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Please use the latest Vercel preview and test please 🙏.

Copy link

vercel bot commented Feb 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:11pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 3:11pm

@graphite-app graphite-app bot requested a review from a team February 26, 2025 15:51
@hbjORbj hbjORbj changed the title perf: stripe import perf: Do not import stripe lib in getServerErrorFromUnknown Feb 26, 2025
@hbjORbj hbjORbj changed the title perf: Do not import stripe lib in getServerErrorFromUnknown perf: Do not import stripe lib in getServerErrorFromUnknown Feb 26, 2025
@keithwillcode keithwillcode added consumer core area: core, team members only labels Feb 26, 2025
Copy link

graphite-app bot commented Feb 26, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (02/26/25)

1 reviewer was added to this PR based on Keith Williams's automation.

@hbjORbj hbjORbj changed the title perf: Do not import stripe lib in getServerErrorFromUnknown perf: Do not import Stripe lib in getServerErrorFromUnknown Feb 26, 2025
Copy link
Contributor

github-actions bot commented Feb 26, 2025

E2E results are ready!

@github-actions github-actions bot marked this pull request as draft February 26, 2025 16:56
@hbjORbj
Copy link
Contributor Author

hbjORbj commented Feb 26, 2025

@zomars Let's copy and paste the relevant parts of the source code instead of relying on "any"s

Addressed!

@hbjORbj hbjORbj marked this pull request as ready for review February 26, 2025 17:22
@dosubot dosubot bot added the performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive label Feb 26, 2025
@zomars
Copy link
Member

zomars commented Feb 26, 2025

Changes look good @hbjORbj. Before merging can we post evidence that a Stripe error is properly being caught and displayed?

zomars
zomars previously approved these changes Feb 26, 2025
@hbjORbj
Copy link
Contributor Author

hbjORbj commented Feb 26, 2025

Before merging can we post evidence that a Stripe error is properly being caught and displayed?v

Gottcha

@hbjORbj hbjORbj requested a review from zomars February 27, 2025 14:58
@hbjORbj hbjORbj marked this pull request as ready for review February 27, 2025 14:58
@hbjORbj
Copy link
Contributor Author

hbjORbj commented Feb 27, 2025

@zomars Hey Zomar, I added a unit test. Can you reapprove after review?

@hbjORbj hbjORbj enabled auto-merge (squash) February 27, 2025 15:04
@hbjORbj hbjORbj merged commit 4d45aa1 into main Feb 27, 2025
37 of 38 checks passed
@hbjORbj hbjORbj deleted the perf/stripe-import branch February 27, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consumer core area: core, team members only performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants