certtools / intelmq-api

FastAPI-based API for the IntelMQ project
https://docs.intelmq.org/latest/user/api/
1 stars 7 forks source link

Status Code 500 - Internal Server Error #28

Closed MarcosxDeveloper closed 3 years ago

MarcosxDeveloper commented 3 years ago

Installation type: native packages

Apache2 Error Logs:

mod_wsgi (pid=2904): Exception occurred processing WSGI script '/usr/lib/python3/dist-packages/intelmq_api/intelmq-api.wsgi'.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/intelmq_api/intelmq-api.wsgi", line 11, in application
from intelmq_api.serve import __hug_wsgi__
File "/usr/lib/python3/dist-packages/intelmq_api/serve.py", line 31, in <module>
api.http.add_middleware(hug.middleware.CORSMiddleware(api, allow_origins=api_config.allow_origins))
AttributeError: module 'hug.middleware' has no attribute 'CORSMiddleware'
MarcosxDeveloper commented 3 years ago

I Fixed Installing hug-middleware-cors 1.0.0

And update the next code line in: /usr/lib/python3/dist-packages/intelmq_api/serve.py

OLD:

api.http.add_middleware(hug.middleware.CORSMiddleware(api, allow_origins=api_config.allow_origins))

NEW:

from hug_middleware_cors import CORSMiddleware
api.http.add_middleware(CORSMiddleware(api, allow_origins=api_config.allow_origins))
ghost commented 3 years ago

Which OS do you use?

Today I identified an issue with the hug/falcon packages and provided more current versions in our repo. Can you check if you see an update and if that fixes your issues after a webserver restart (apt update && apt upgrade && systemctl restart apache2)

MarcosxDeveloper commented 3 years ago

hello @wagner-certat ,

I use Ubuntu 18.04 LTS.

I Solved my problem removing my code and execute your script.

Thanks a lot.

ghost commented 3 years ago

Thanks for the feedback (and reporting the issue)!

I hope we have found and fixed all issues now, we'll do bugfix releases next week.