Error in ASGI app

Hi. I get the error

[2019-12-12 11:30:16 +0000] [11] [ERROR] Exception in ASGI application
Traceback (most recent call last):
 File “/usr/local/lib/python3.7/site-packages/uvicorn/protocols/http/httptools_impl.py”, line 372, in run_asgi
   result = await asgi(self.receive, self.send)
 File “/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py”, line 125, in asgi
   raise exc from None
 File “/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py”, line 102, in asgi
   asgi = self.app(scope)
 File “/usr/local/lib/python3.7/site-packages/newrelic/api/web_transaction.py”, line 996, in wrapper
   return proxy(wrapped(*args, **kwargs), context_manager)
TypeError: call() missing 2 required positional arguments: ‘receive’ and ‘send’

This is how I start my fastapi service:

NEW_RELIC_CONFIG_FILE=/app/newrelic.ini newrelic-admin run-program gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker -b 127.0.0.1:8000

What am I doing wrong?

Hi @wycliff,

Based on this error message below:

File “/usr/local/lib/python3.7/site-packages/starlette/middleware/errors.py”, line 102, in asgi
asgi = self.app(scope)

It seems you will need to upgrade the starlette version you currently have running with ASGI. It’s possible the version of starlette you have running is using the old ASGI interface:

You will need to upgrade the starlette framework to version 0.12.0 or latest.

Kindly give that a try and let us know of the outcome.

Best!