0
votes

I'm developing a Flask app on App Engine VM. I want to upload file to Google Cloud Storage so i use storage_client = storage.Client() to connect to cloud storage. My app is working perfectly without error when testing in VM alone. However, after I deployed using gcloud app deploy and tested the upload function on my deployed app, it failed and returned Internet 500 error. The log showed the traceback and it is due to the line of code connecting to cloud storage: storage_client = storage.Client()

The specific error is __init__() takes 2 positional arguments but 3 were given shown in cloud storage library function. I have python 3.5 for this app and i really don't know how to resolve this. Any help would be really appreciated!

Traceback (most recent call last):
  File \"/env/lib/python3.5/site-packages/flask/app.py\", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File \"/env/lib/python3.5/site-packages/flask/_compat.py\", line 35, in reraise
    raise value
  File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File \"/env/lib/python3.5/site-packages/flask/app.py\", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File \"/home/vmagent/app/main.py\", line 59, in select_date
    generate_report(log_lists)
  File \"/home/vmagent/app/main.py\", line 83, in generate_report
    storage_client = storage.Client()
  File \"/env/lib/python3.5/site-packages/google/cloud/storage/client.py\", line 86, in __init__
    self._connection = Connection(self, client_info=client_info)
  File \"/env/lib/python3.5/site-packages/google/cloud/storage/_http.py\", line 33, in __init__
    super(Connection, self).__init__(client, client_info)
TypeError: __init__() takes 2 positional arguments but 3 were given

And below is my "requirements.txt":

Flask==1.0.2
gunicorn==19.9.0
firebase-admin==2.13.0
google-cloud-firestore==0.29.0
google-cloud-storage==1.17.0
lxml==3.7.3
1
Can you share your requirements.txt file?Dustin Ingram
Flask==1.0.2 gunicorn==19.9.0 firebase-admin==2.13.0 google-cloud-firestore==0.29.0 google-cloud-storage==1.17.0 lxml==3.7.3kdg
Is this the problem with google-cloud-storage version? thankskdg

1 Answers

2
votes

You are using old libraries. Update your requirements.txt to use the current versions.

For example:

You are using google-cloud-firestore==0.29.0 but the current version is google-cloud-firestore==1.3.0

Most of your modules are out of date and in some case not compatible (and ancient library with a current library).