AttributeError: 'Credentials' object has no attribute 'authorize'

2,253 views
Skip to first unread message

Harsha Reddy

unread,
Dec 7, 2016, 8:47:37 AM12/7/16
to Google App Engine
I am getting following error while deploying the app. I have changed peoject Id in config file.

ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error:
13:33:52 system      | bookshelf.1 started (pid=7)
13:33:53 bookshelf.1 | [2016-12-07 13:33:53 +0000] [9] [INFO] Starting gunicorn 19.6.0
13:33:53 bookshelf.1 | [2016-12-07 13:33:53 +0000] [9] [INFO] Listening at: http://0.0.0.0:8080 (9)
13:33:53 bookshelf.1 | [2016-12-07 13:33:53 +0000] [9] [INFO] Using worker: sync
13:33:53 bookshelf.1 | [2016-12-07 13:33:53 +0000] [12] [INFO] Booting worker with pid: 12
13:33:54 bookshelf.1 | [2016-12-07 13:33:54 +0000] [12] [ERROR] Exception in worker process
13:33:54 bookshelf.1 | Traceback (most recent call last):
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
13:33:54 bookshelf.1 |     worker.init_process()
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/workers/base.py", line 126, in init_process
13:33:54 bookshelf.1 |     self.load_wsgi()
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
13:33:54 bookshelf.1 |     self.wsgi = self.app.wsgi()
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/app/base.py", line 67, in wsgi
13:33:54 bookshelf.1 |     self.callable = self.load()
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
13:33:54 bookshelf.1 |     return self.load_wsgiapp()
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
13:33:54 bookshelf.1 |     return util.import_app(self.app_uri)
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/gunicorn/util.py", line 357, in import_app
13:33:54 bookshelf.1 |     __import__(module)
13:33:54 bookshelf.1 |   File "/home/vmagent/app/main.py", line 19, in <module>
13:33:54 bookshelf.1 |     app = bookshelf.create_app(config)
13:33:54 bookshelf.1 |   File "/home/vmagent/app/bookshelf/__init__.py", line 41, in create_app
13:33:54 bookshelf.1 |     handler = CloudLoggingHandler(client)
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/google/cloud/logging/handlers/handlers.py", line 80, in __init__
13:33:54 bookshelf.1 |     self.transport = transport(client, name)
13:33:54 bookshelf.1 |   File "/env/lib/python3.4/site-packages/google/cloud/logging/handlers/transports/background_thread.py", line 154, in __init__
13:33:54 bookshelf.1 |     http = client._connection.credentials.authorize(http)
13:33:54 bookshelf.1 | AttributeError: 'Credentials' object has no attribute 'authorize'
13:33:54 bookshelf.1 | [2016-12-07 13:33:54 +0000] [12] [INFO] Worker exiting (pid: 12)
13:33:54 bookshelf.1 | [2016-12-07 13:33:54 +0000] [9] [INFO] Shutting down: Master
13:33:54 bookshelf.1 | [2016-12-07 13:33:54 +0000] [9] [INFO] Reason: Worker failed to boot.
13:33:54 system      | bookshelf.1 stopped (rc=3)

George (Cloud Platform Support)

unread,
Dec 7, 2016, 1:49:08 PM12/7/16
to Google App Engine

Hello Harsha,


What steps did you undertake before you ran the "gcloud app deploy" command? Are you properly identified on the cloud platform? Did you identify as described here? More information covering the gcloud command may be accessed via this page.


How does your config file look like? You may consider providing any extra details you find relevant.

Harsha Reddy

unread,
Dec 8, 2016, 2:23:15 AM12/8/16
to Google App Engine
Hi George,

Thanks for your reponse. I have followed this tutorial(https://cloud.google.com/python/getting-started/using-pub-sub) to deploy app. In the config.py file I have changed the project-id,GOOGLE_OAUTH2_CLIENT_ID,GOOGLE_OAUTH2_CLIENT_SECRET. In app.yaaml i used default settings.  I also ran gcloud auth list command (says my account active). Please let me know what else I should do before deploying.

Thanks
Harsha Reddy

Jon Wayne Parrott

unread,
Dec 8, 2016, 2:05:53 PM12/8/16
to Google App Engine
HI Harsha,
There was a bad dependency in this tutorial. Can you try pulling the latest version? It should list `google-cloud==0.21.1` in the requirements.txt file.

Harsha Reddy

unread,
Dec 9, 2016, 7:33:46 AM12/9/16
to Google App Engine
Hi Jon,

Thanks. It worked for me. But the app(worker) which I deployed on app engine not able to fetch messages from pubsub. I dont want to run worker in application context( I will push messages queue from anywhere. my worker should listen to the queue and logs the messages) So I changed psq library according to my requirement and installed it on app engine using github link. This worker is working fine when i run it on local machine but on app engine its not working. Please help me

Jon Wayne Parrott

unread,
Dec 9, 2016, 12:23:49 PM12/9/16
to Google App Engine
Can you provide me with the logs from the worker as well as any changes you made to the worker or psq?

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/cloz6WTntcg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/794a0047-fdc2-40fd-94d8-f147dbb053c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Harsha Reddy

unread,
Dec 9, 2016, 2:36:39 PM12/9/16
to Google App Engine
Hi jon,

I just changed dequeue( pulls the message from queue not task) method in queue.py and listen method in worker.py(logs the message instead of running any task)

Jon Wayne Parrott

unread,
Dec 9, 2016, 3:48:46 PM12/9/16
to Google App Engine
It's much more helpful I can see the exact code - do you have it github?

Also any logs from the worker application would be really helpful to figure out what's going wrong. Feel free to share those with me privately.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages