-
Notifications
You must be signed in to change notification settings - Fork 752
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
GitHub Actions Workflow Fails to Authenticate Earth Engine API, but Works Locally or Tutorial Request: Github actions for earthengine #861
Comments
@jdbcode , do you have any ideas? I'm trying to include the ee package in a CI/CD pipeline but I'm encountering issues during the authentication phase. |
Hmm, I wonder if the credentials formatting is causing a problem. Can you provide it without new lines and tabs - just a single line with one space between common and next field:
|
Hello @jdbcode, Thank you for your response and suggestion! I went ahead and copied the content of the credentials file into the EARTHENGINE_CREDENTIAL environment variable, ensuring it was all on one line, with a single space between each field, as you recommended. Unfortunately, I am still encountering the same issue during the authentication phase. You can view the error trace in this job log: Earth Engine API Test Job Log](https://github.com/thekester/earthengine-api-test/actions/runs/10946792224/job/31575230100) Here are also the images of the current setup and error trace: I would appreciate any further advice you might have regarding how to resolve this issue. Thanks again for your help! |
Thank you! It seems the issue has been successfully resolved, as indicated by the GitHub Actions log (https://github.com/jdbcode/earth_engine_github_actions/actions/runs/11354079027/job/31580510185). I'll give it a try in my own code as well. |
Thank you @jdbcode, I’ve resolved the issue using the following configuration: |
Python Script to Reformat JSON This Python script reads a JSON file that is formatted with indentation and line breaks, reformats it into a single line, and saves the result to another file. `import json Function to reformat the JSONdef reformat_json(input_file, output_file):
Specify the input and output file namesinput_file = 'input.json' # Replace with your input file name Call the function to reformat the JSONreformat_json(input_file, output_file) print(f"The JSON has been reformatted and saved to '{output_file}'.")` Input JSON Structure Create a file named input.json with the following content, using placeholders for your actual credentials: Expected Output After running the script, the content of output.json will be reformatted into a single line, like this:
|
I'm glad you've got it figured out now. In the meantime I put together an example and now I see you have one too. https://github.com/gee-community/ee-initialize-github-actions/blob/main/README.md In yours, since you're writing the credentials secret to ~/.config/earthengine/credentials, you should not need to use We should maybe try to combine these two tutorials. I'd like to add to mine the option to write the credentials file and use |
Thanks now i'm just using ee in the test.py and i'm using that in the workflow file |
Hello, I couldn't find a tutorial to properly configure Earth Engine on GitHub Actions, so I attempted to do it myself, but I'm encountering an error.
Description: The Earth Engine API test script works as expected on a local machine when authenticated, but the workflow fails during execution in GitHub Actions. The error encountered in the workflow suggests an issue with parsing the credentials JSON file, even though the same setup works locally.
https://github.com/thekester/earthengine-api-test
Error Trace:
The credentials are stored as a GitHub secret (EARTHENGINE_CREDENTIALS) and are passed into the workflow, but something is going wrong during the authentication process in the GitHub Actions environment.
Steps to Reproduce:
Expected Behavior: The workflow should initialize the Earth Engine API correctly and authenticate using the credentials provided via GitHub secrets, just as it does in a local environment.
Actual Behavior: The workflow fails with a JSONDecodeError during the API initialization step, indicating that the credentials are either not properly passed to the workflow or the JSON is not being decoded correctly.
The GitHub Actions workflow in this repository, earthengine-api-test. encounters an issue during execution, while the same process works locally without problems.
Additional Context: The script works locally, so the issue seems to be specific to the GitHub Actions environment. This may involve how secrets are being handled, or how the credentials file is being written and accessed within the workflow.
The text was updated successfully, but these errors were encountered: