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

test(google-cloud): Replace error handling using node domain #14908

Merged

Conversation

GrizliK1988
Copy link
Contributor

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests (this PR modifies only tests)
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

Hi!

I'd like to take an opportunity and make a small contribution to this project and this good first issue to fix issue #14769.

As it turns out - domain api is deprecated since really long time and there is no one to one replacement so far.

This PR implements a simple error handling to test failures. This is not a one to one replacement of domain based logic - in tests we have a luxury of knowing which failures to anticipate and handle & assert them accordingly.

@GrizliK1988 GrizliK1988 force-pushed the test/14769_replace_domain_usage branch 2 times, most recently from de02754 to 915fe0e Compare January 7, 2025 11:59
@GrizliK1988
Copy link
Contributor Author

Fixed lint failure.

Interesting that I can't get it locally 🤔 . Will look into that.

@Zen-cronic
Copy link
Contributor

Fixed lint failure.

Interesting that I can't get it locally 🤔 . Will look into that.

AFAIK, there are two types of linter for js/ts code in this repo: biome & eslint.
You can run:

  • yarn lint:biome in root
  • yarn lint (eslint) in the individual packages you updated OR yarn lint in root (this can take a while)

Both are checked in CI

@GrizliK1988
Copy link
Contributor Author

Thank you @Zen-cronic !

Indeed - biome was the one, raising an error about code style. From root of the project lint:biome generates multiple warnings for several *.d.ts files. However when pointed to packages/google-cloud-serverless, only single report about missing ; is there.

Fix added already (squashed and rebased).

@mydea mydea requested review from AbhiPrasad and lforst January 13, 2025 09:07
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing but otherwise looks good 👍 thanks!

}),
);

(async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we even need to make this an IIF?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed per se - it's here to simplify error handling with await to get an exception for both synchronous and asynchronous flows.

can be easily replaced with Promise instead. let me push an update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied a change, please let me know if it looks better now

@GrizliK1988 GrizliK1988 force-pushed the test/14769_replace_domain_usage branch 2 times, most recently from 915fe0e to 01b1e09 Compare January 13, 2025 10:29
…ry#14769)

Replace error handling using deprecated node:domain in google-cloud-serverless tests

Fixes getsentry#14769
@GrizliK1988 GrizliK1988 force-pushed the test/14769_replace_domain_usage branch from 01b1e09 to e5c096b Compare January 13, 2025 10:30
@lforst lforst changed the title test(google-cloud): Replace error handling using node domain (#14769) test(google-cloud): Replace error handling using node domain Jan 13, 2025
@@ -1,4 +1,4 @@
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, isThenable } from '@sentry/core';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe isThenable is not used.

also thank you for this simplification - I've missed the fact that _wrapEventFunction calls callback and no extra Promise waiting needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I just add a commit to fix biome warning? not sure about squashing at this point though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we squash all of our prs - don't worry about clean commit history

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok - thanks for clarification. pushed a fix

@AbhiPrasad AbhiPrasad enabled auto-merge (squash) January 17, 2025 17:27
@AbhiPrasad AbhiPrasad merged commit 4b0d06f into getsentry:develop Jan 17, 2025
139 checks passed
@lforst
Copy link
Member

lforst commented Jan 17, 2025

omg thanks @AbhiPrasad for actually merging this. I had too much on my plate. Sorry for letting this fall through.

mydea added a commit that referenced this pull request Jan 20, 2025
This PR adds the external contributor to the CHANGELOG.md file, so that
they are credited for their contribution. See #14908

---------

Co-authored-by: AbhiPrasad <18689448+AbhiPrasad@users.noreply.github.com>
Co-authored-by: Francesco Gringl-Novy <francesco.novy@sentry.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants