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

Sanic: IndexError tuple index out of range with latest version of sanic #2240

Closed
HaithamMaya opened this issue Mar 26, 2021 · 1 comment · Fixed by #2379
Closed

Sanic: IndexError tuple index out of range with latest version of sanic #2240

HaithamMaya opened this issue Mar 26, 2021 · 1 comment · Fixed by #2379
Labels

Comments

@HaithamMaya
Copy link

HaithamMaya commented Mar 26, 2021

Thanks for taking the time for reporting an issue!

Before reporting an issue on dd-trace-py, please be sure to provide all
necessary information.

If you're hitting a bug, make sure that you're using the latest version of this
library.

Which version of dd-trace-py are you using?

ddtrace==0.47.0

Which version of the libraries are you using?

sanic==21.3.2

You can copy/paste the output of pip freeze here.

How can we reproduce your problem?

from ddtrace import patch_all
patch_all(sanic=True)

from sanic import Sanic
from sanic.response import text

app = Sanic(__name__)

@app.route('/')
def index(request):
    return text('hello world')

if __name__ == '__main__':
    app.run()

What is the result that you get?

	Traceback (most recent call last):
	  File "/opt/venv/lib/python3.9/site-packages/sanic/http.py", line 125, in http1
	    await self.protocol.request_handler(self.request)
	  File "/opt/venv/lib/python3.9/site-packages/ddtrace/contrib/sanic/patch.py", line 86, in patch_handle_request
	    write_callback = kwargs.get("write_callback", args[1])
	IndexError: tuple index out of range

What is the result that you expected?

No failure

@Kyle-Verhoog
Copy link
Member

Hi @HaithamMaya, thanks for the report!

Indeed it looks like sanic had a significant refactor in sanic-org/sanic#1876 in which the handle_request method's signature was changed which has resulted in the error you're seeing.

We'll work on getting a fix in for this 🙂

nizox added a commit to nizox/dd-trace-py that referenced this issue May 3, 2021
@Kyle-Verhoog Kyle-Verhoog linked a pull request May 3, 2021 that will close this issue
4 tasks
@mergify mergify bot closed this as completed in #2379 Jun 17, 2021
mergify bot added a commit that referenced this issue Jun 17, 2021
* fix(sanic): support latest version (#2240)

* add a release note

* add more tests

* More tests

* rewrite release note

* Bump pytest-sanic to 1.7.1

* Fix tests & compat with older versions

* Lock deps versions in tox

Co-authored-by: Gabriele N. Tornetta <[email protected]>
Co-authored-by: Yun Kim <[email protected]>
Co-authored-by: Kyle Verhoog <[email protected]>
Co-authored-by: Brett Langdon <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants