Description
Issue Description
Deploying an R Shiny app to shinyapps.io using Earth Engine via rgee, I'm encountering an issue with non-interactive authentication:
App deployment unexpectedly falls back to interactive OAuth, prompting for a verification code.
Non-interactive authentication works locally but fails when deployed to shinyapps.io.
Reproducible Example
Local test (works fine):
library(reticulate)
reticulate::py_run_string(
"import ee; ee.Initialize(project='able-device-311600-453303'); print(ee.data.getAssetRoots())"
)
Returns expected asset roots locally:
[{'type': 'Table', 'id': 'projects/able-device-311600-453303/assets/Bool_area_3577'}]
shinyapps.io setup (failing):
.Renviron
configuration:
GOOGLE_APPLICATION_CREDENTIALS="/srv/connect/apps/AusPlots_S2/credentials/able-device-311600-453303-dcb943459adc.json"
EE initialization within the deployed app:
library(rgee)
ee_Initialize(
user = "able-device-311600@able-device-311600-453303.iam.gserviceaccount.com",
credentials = "persistent",
project = "able-device-311600-453303",
drive = FALSE,
gcs = FALSE,
quiet = TRUE,
auth_mode = "appdefault"
)
Upon deployment, the app ignores provided credentials and attempts interactive OAuth, causing deployment to fail.
Checks already done
- Cleared cached credentials before deployment.
- Confirmed local non-interactive authentication is working correctly.
- Verified service account permissions and asset sharing.
- Attempted the logic provided in the shiny_rgee_template example, encountering the same issue.
- Noted the official rgee demo (cesar-aybar.shinyapps.io/rgee_app_demo) is also currently failing, possibly indicating a broader authentication issue?
Expected Behavior
Non-interactive authentication succeeds using provided credentials on shinyapps.io deployment without prompting for interactive OAuth.
Actual Behavior
Interactive OAuth prompt prevents successful app deployment.
Environment
- R version: 4.4.2 (2024-10-31 ucrt)
- rgee version: 1.1.7
- reticulate version: 1.40.0
- Shiny version: 1.9.1
- Deployment target: shinyapps.io
Any guidance or workarounds to resolve this issue would be greatly appreciated.
Thank you!
Chris