giswqs / geemap-heroku

Python scripts for deploying Earth Engine Apps to heroku
MIT License
25 stars 41 forks source link

Having EARTHENGINE_TOKEN as a heroku config var doesn't seem to work anymore #3

Closed jjaakko closed 3 years ago

jjaakko commented 3 years ago

I ran the config_vars.py script and verified in Heroku that the config var exists with the correct content. However, the app fails to run. I added --debug flag in Procfila for voila and this is what I get:

FileNotFoundError                         Traceback (most recent call last)
~/.heroku/python/lib/python3.8/site-packages/ee/data.py in get_persistent_credentials()
    218   try:
--> 219     tokens = json.load(open(oauth.get_credentials_path()))
    220     refresh_token = tokens['refresh_token']

FileNotFoundError: [Errno 2] No such file or directory: '/app/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
<ipython-input-1-44c582ebe6c9> in <module>
     11 
     12 #ee.Authenticate()
---> 13 ee.Initialize()

~/.heroku/python/lib/python3.8/site-packages/ee/__init__.py in Initialize(credentials, opt_url, cloud_api_key, http_transport, project)
    113   """
    114   if credentials == 'persistent':
--> 115     credentials = data.get_persistent_credentials()
    116   data.initialize(
    117       credentials=credentials,

~/.heroku/python/lib/python3.8/site-packages/ee/data.py in get_persistent_credentials()
    227         scopes=oauth.SCOPES)
    228   except IOError:
--> 229     raise ee_exception.EEException(
    230         'Please authorize access to your Earth Engine account by '
    231         'running\n\nearthengine authenticate\n\nin your command line, and then '

EEException: Please authorize access to your Earth Engine account by running

earthengine authenticate

in your command line, and then retry.

I wonder if something has change in the python ee library or why the authentication doesn't seem to work.

giswqs commented 3 years ago

See https://github.com/giswqs/geemap/discussions/465#discussioncomment-710744

jjaakko commented 3 years ago

Thanks! That solves the issue.