Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

type error in view.schema.get_operation() #156

Closed
sennierer opened this issue Sep 23, 2020 · 5 comments
Closed

type error in view.schema.get_operation() #156

sennierer opened this issue Sep 23, 2020 · 5 comments

Comments

@sennierer
Copy link

Describe the bug
When deploying our locally working instance to production we get the following error:

File "/drf-spectacular/drf_spectacular/generators.py", line 153, in parse
    operation = view.schema.get_operation(path, path_regex, method, self.registry)
TypeError: get_operation() takes 3 positional arguments but 5 were given

As this happens only on the server it is hard to trace, but I guess the error is due to our reverse proxy setup that passes X-Headers-* on and proxies requests from http to https.

@tfranzel
Copy link
Owner

i have a different theory because that error feels way too familiar. @sennierer do you have a different config in production? i would guess your production config is missing

REST_FRAMEWORK = {
    # YOUR SETTINGS
    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

@sennierer
Copy link
Author

found out just a minute after posting, on the servers we still had an old settings running ;)
sorry for that, cloding the issue!

@tfranzel
Copy link
Owner

no problem. it happened to me a couple of times. since the root cause is not that obvious i'll add an error message that points new users in the right direction.

@stefanpl
Copy link

stefanpl commented Jul 3, 2022

I got the same error when calling

manage.py generateschema --file …

instead of

manage.py spectacular --file …

🙈

@tfranzel
Copy link
Owner

tfranzel commented Jul 4, 2022

@stefanpl, yes that is the second way to get this error.

generateschema will start the DRF's default schema generator, which has nothing to do with us.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants