Skip to content

sentry-sdk[grpcio] requires protobuf #3080

Closed
@DazWilkin

Description

@DazWilkin

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.2.0

Steps to Reproduce

See: https://stackoverflow.com/questions/78488561

Followed Sentry documentation gRPC

python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade 'sentry-sdk[grpcio]'

python3 -m pip freeze
certifi==2024.2.2
grpcio==1.63.0
sentry-sdk==2.2.0
urllib3==2.2.1

main.py:

import grpc

import sentry_sdk
from sentry_sdk.integrations.grpc import GRPCIntegration

sentry_sdk.init(
    dsn="https://...",
    enable_tracing=True,
    integrations=[
        GRPCIntegration(),
    ],
)

with grpc.insecure_channel("example.com:12345") as channel:
    print(channel)

Expected Result

Happy path.

Actual Result

python3 main.py
Traceback (most recent call last):
  File "[redacted]/venv/lib/python3.10/site-packages/sentry_sdk/integrations/grpc/client.py", line 15, in <module>
    from google.protobuf.message import Message
ModuleNotFoundError: No module named 'google'

integrations/grpc/client.py:

try:
    import grpc
    from grpc import ClientCallDetails, Call
    from grpc._interceptor import _UnaryOutcome
    from grpc.aio._interceptor import UnaryStreamCall
    from google.protobuf.message import Message      <-------------- curious
except ImportError:
    raise DidNotEnable("grpcio is not installed")

Solution

python3 -m pip install protobuf
python3 -m pip freeze
certifi==2024.2.2
grpcio==1.63.0
protobuf==5.26.1
sentry-sdk==2.2.0
urllib3==2.2.1

Then works.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions