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

AttributeError: 'NoneType' object has no attribute 'config' in Flask Agent #1098

Closed
DougDK opened this issue Apr 13, 2021 · 0 comments · Fixed by #1099
Closed

AttributeError: 'NoneType' object has no attribute 'config' in Flask Agent #1098

DougDK opened this issue Apr 13, 2021 · 0 comments · Fixed by #1099

Comments

@DougDK
Copy link
Contributor

DougDK commented Apr 13, 2021

Describe the bug: By using the flask agent and opting to build the application on the fly an error occurs AttributeError: 'NoneType' object has no attribute 'config'.

To Reproduce

  1. run the following
from elasticapm.contrib.flask import ElasticAPM
from flask import Flask
apm = ElasticAPM()

app = Flask(__name__)
apm.init_app(app)

Environment (please complete the following information)

  • OS: Linux
  • Python version: 3.8.5
  • Framework and version: Flask 1.1.2
  • APM Server version: NA
  • Agent version: NA

Additional context

This error does not happen with version 6.0.0. This bug seems to be incorporated into the project in the PR-1043 with the removal from the if statement L128 - L129 in the init_app() method that would initiate a possible NoneType client. Based on the efforts of the PR-1043 to make the client global, it would ideally be initiated in the constructor from the class ElasticAPM. That would only apply if there's an existent app which does not happen if the user opted to build the application on the fly.

tonyman19 referenced this issue Apr 14, 2021
* Make Client object globally available

* Remove global client object on Client.close()

* Fix django's get_client to use elasticapm.get_client

* Clean up more client creation

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

Successfully merging a pull request may close this issue.

1 participant