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

Fast API Websocket coroutines throw attribute error when run with newrelic admin #742

Open
sankarpa opened this issue Jan 17, 2023 · 5 comments
Assignees

Comments

@sankarpa
Copy link

sankarpa commented Jan 17, 2023

Description
I am using newrelic agent 8.5.0 with my fastapi which houses both rest and websocket apis. The app get deployed in kubernetes and here is how the container command looks like

   containers:
        - name: a-service
          image: 'a-service:latest'
          command:
            - newrelic-admin
            - run-program
            - uvicorn
            - app.main:app
            - --port=8000
            - --host=0.0.0.0
          resources:
            requests:
              memory: "512Mi"
              cpu: "500m"
            limits:
              memory: "512Mi"
              cpu: "500m"
          ports:
            - containerPort: 8000
              protocol: TCP

The container comes up healthy and runs , but the coroutines throws error with attribute not found error when calling async functions. The same is working fine when i run the container without newrelic-admin

@TimPansino
Copy link
Contributor

Hello,

Could you perhaps supply a reproduction or at least some more specifics?

I was unable to reproduce any issue with the latest version of the agent. FastAPI has a minimalist example that I ran some testing against. I was using an async websocket endpoint and both sync and async HTTP routes were working alongside it with no issues.

@Ak-x
Copy link

Ak-x commented Mar 17, 2023

Hello @sankarpa, without reproduction steps we will close this ticket in 30 days.

@stale stale bot removed the stale label Mar 17, 2023
@stale
Copy link

stale bot commented May 22, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 22, 2023
@sankarpa
Copy link
Author

sankarpa commented Jun 14, 2023

Hi @Ak-x @TimPansino Sorry for responding late, I am using aioredis pubsub in the websocket functions and the code looks like below.

pubsub = redis.pubsub()       
await pubsub.subscribe(f"{channel_id}")
await websocket.accept()

if I don't use newrelic agent , the subscribe function call works fine .

I get below error if I initialise the newrelic agent and connect to the websocket

AttributeError: 'coroutine' object has no attribute 'subscribe'

@stale stale bot removed the stale label Jun 14, 2023
@sankarpa
Copy link
Author

@TimPansino Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants