fastapi-jsonrpc icon indicating copy to clipboard operation
fastapi-jsonrpc copied to clipboard

Got SentryHubDeprecationWarning without sentry_sdk.init

Open kalombos opened this issue 3 weeks ago • 2 comments

When I run my tests, I get SentryHubDeprecationWarning warnings even though I don’t initialize Sentry anywhere in the tests. Perhaps here it would make sense to check whether Sentry has actually been initialized, rather than just checking for the presence of the installed package. I found a solution here The Python equivalent would look like this:

is_init = sentry_sdk.Hub.current.client is not None

kalombos avatar Dec 08 '25 12:12 kalombos

Can you check it in your environment? I mean, change the local line and see if the warning is still present.

spumer avatar Dec 08 '25 17:12 spumer

Yes, I’ve already tested it locally and the warning does appear. You can also reproduce it using the example from the README by installing sentry_sdk. If you call the echo method, you’ll see the warning:

python test.py 
INFO:     Started server process [25349]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:5000 (Press CTRL+C to quit)
.venv/lib/python3.13/site-packages/fastapi_jsonrpc/__init__.py:656: UserWarning: Implicit Sentry integration is deprecated and may be removed in a future major release. To ensure compatibility, use sentry-sdk 2.* and explicit integration:`from fastapi_jsonrpc.contrib.sentry import FastApiJsonRPCIntegration`. 
  warnings.warn(

Once sentry_sdk is removed, the warning no longer shows up.

kalombos avatar Dec 09 '25 05:12 kalombos