Title: google.cloud.error_reporting AttributeError: 'Client' object has no attribute 'project' · Issue #3167 · googleapis/google-cloud-python · GitHub
Open Graph Title: google.cloud.error_reporting AttributeError: 'Client' object has no attribute 'project' · Issue #3167 · googleapis/google-cloud-python
X Title: google.cloud.error_reporting AttributeError: 'Client' object has no attribute 'project' · Issue #3167 · googleapis/google-cloud-python
Description: I am trying to follow the sample code here in an appengine custom flexible runtime and whenever I run the code, I get the following error: Traceback (most recent call last): File "/env/lib/python3.5/site-packages/flask/app.py", line 1994...
Open Graph Description: I am trying to follow the sample code here in an appengine custom flexible runtime and whenever I run the code, I get the following error: Traceback (most recent call last): File "/env/lib/python3....
X Description: I am trying to follow the sample code here in an appengine custom flexible runtime and whenever I run the code, I get the following error: Traceback (most recent call last): File "/env/lib/pyt...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/3167
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"google.cloud.error_reporting AttributeError: 'Client' object has no attribute 'project'","articleBody":"I am trying to follow the sample code [here](https://googlecloudplatform.github.io/google-cloud-python/stable/error-reporting-usage.html) in an appengine custom flexible runtime and whenever I run the code, I get the following error:\r\n\r\n```\r\nTraceback (most recent call last):\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1994, in __call__\r\n return self.wsgi_app(environ, start_response)\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1985, in wsgi_app\r\n response = self.handle_exception(e)\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1540, in handle_exception\r\n reraise(exc_type, exc_value, tb)\r\n File \"/env/lib/python3.5/site-packages/flask/_compat.py\", line 33, in reraise\r\n raise value\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1982, in wsgi_app\r\n response = self.full_dispatch_request()\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1614, in full_dispatch_request\r\n rv = self.handle_user_exception(e)\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1517, in handle_user_exception\r\n reraise(exc_type, exc_value, tb)\r\n File \"/env/lib/python3.5/site-packages/flask/_compat.py\", line 33, in reraise\r\n raise value\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1612, in full_dispatch_request\r\n rv = self.dispatch_request()\r\n File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1598, in dispatch_request\r\n return self.view_functions[rule.endpoint](**req.view_args)\r\n File \"/home/vmagent/app/xxx.py\", line 20, in simulate_error\r\n ec.report_exception()\r\n File \"/env/lib/python3.5/site-packages/google/cloud/error_reporting/client.py\", line 348, in report_exception\r\n user=user)\r\n File \"/env/lib/python3.5/site-packages/google/cloud/error_reporting/client.py\", line 277, in _send_error_report\r\n self.report_errors_api.report_error_event(error_report)\r\n File \"/env/lib/python3.5/site-packages/google/cloud/error_reporting/client.py\", line 162, in report_errors_api\r\n self._report_errors_api = make_report_error_api(self)\r\n File \"/env/lib/python3.5/site-packages/google/cloud/error_reporting/_gax.py\", line 44, in make_report_error_api\r\n return _ErrorReportingGaxApi(gax_client, client.project)\r\nAttributeError: 'Client' object has no attribute 'project'\r\n```\r\nIn the same project I'm also creating clients for pubsub and storage with the same default constructor and they both find the project and credentials, both when running in appengine as well as when I run the container locally and specify credentials by setting GOOGLE_APPLICATION_CREDENTIALS to point to a json file containing credentials for a service account.\r\n\r\nI have also tried explicitly passing the project explicitly using something like:\r\n\r\n```\r\nec = error_reporting.Client(project='xyz')\r\n```\r\n\r\nand\r\n\r\n```\r\nec = error_reporting.Client('xyz')\r\n```\r\n\r\nto no avail.\r\n\r\nHere is the sample code that fails:\r\n\r\n```\r\nfrom flask import Flask\r\nfrom google.cloud import error_reporting\r\n\r\n\r\napp = Flask(__name__)\r\n\r\n\r\n@app.route('/simulate_error')\r\ndef simulate_error():\r\n ec = error_reporting.Client()\r\n try:\r\n # simulate calling a method that's not defined\r\n raise NameError\r\n except Exception:\r\n ec.report_exception()\r\n\r\n\r\nif __name__ == '__main__':\r\n app.run(host='0.0.0.0', debug=True)\r\n```\r\n\r\nHere is the output from `pip freeze | grep ^google-cloud`:\r\n\r\n```\r\ngoogle-cloud==0.23.0\r\ngoogle-cloud-bigquery==0.23.0\r\ngoogle-cloud-bigtable==0.23.1\r\ngoogle-cloud-core==0.23.1\r\ngoogle-cloud-datastore==0.23.0\r\ngoogle-cloud-dns==0.23.0\r\ngoogle-cloud-error-reporting==0.23.1\r\ngoogle-cloud-language==0.23.1\r\ngoogle-cloud-logging==0.23.1\r\ngoogle-cloud-monitoring==0.23.0\r\ngoogle-cloud-pubsub==0.23.0\r\ngoogle-cloud-resource-manager==0.23.0\r\ngoogle-cloud-runtimeconfig==0.23.0\r\ngoogle-cloud-spanner==0.23.1\r\ngoogle-cloud-speech==0.23.0\r\ngoogle-cloud-storage==0.23.1\r\ngoogle-cloud-translate==0.23.0\r\ngoogle-cloud-vision==0.23.3\r\n```","author":{"url":"https://github.com/cva","@type":"Person","name":"cva"},"datePublished":"2017-03-19T00:24:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/3167/google-cloud-python/issues/3167"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4d343b5f-a3d1-7ef3-741a-a88111b8f902 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EE04:DCF9D:1806FE:209053:6A4D8546 |
| html-safe-nonce | f23ff6ca6a146ab2e239723192189979d59a8ce671bd7e0294fa04ce0c7a0389 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRTA0OkRDRjlEOjE4MDZGRToyMDkwNTM6NkE0RDg1NDYiLCJ2aXNpdG9yX2lkIjoiMjAxOTk0OTQwMTk5NzE0OTUxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 78291576c36e72869054f669d4972130fc11c4a00c1b5a2f490f5bfd128f891d |
| hovercard-subject-tag | issue:215231545 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/3167/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d9b6dc07c57db3adf7e2d350545028068bc1710a66b700f34f673b4ce008c95/googleapis/google-cloud-python/issues/3167 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d9b6dc07c57db3adf7e2d350545028068bc1710a66b700f34f673b4ce008c95/googleapis/google-cloud-python/issues/3167 |
| og:image:alt | I am trying to follow the sample code here in an appengine custom flexible runtime and whenever I run the code, I get the following error: Traceback (most recent call last): File "/env/lib/python3.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cva |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6bf61c909482ec3072ef5d7a5a28f2a9d214788c9a44793eca1960048cb05ae |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6702a58b419a792226bd21ef0fb1bcb318bbcaa3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width