Skip to content

fix(ingestion): set code location env vars at a scope that reaches the container - #842

Merged
jirhiker merged 2 commits into
stagingfrom
fix/dg-code-location-scope
Aug 19, 2026
Merged

fix(ingestion): set code location env vars at a scope that reaches the container#842
jirhiker merged 2 commits into
stagingfrom
fix/dg-code-location-scope

Conversation

@jirhiker

Copy link
Copy Markdown
Member

database_connectivity kept failing with DefaultCredentialsError after the
key was set and verified in the Dagster+ UI. The key was real; the container
never saw it.

Cause

Dropping --global from the setup script scoped variables to OcotilloAPI
the project name from pyproject.toml — rather than to
ocotillo-automated-ingestion, the location_name in dagster_cloud.yaml.

Dagster+ accepts an unknown location name without complaint. The variable shows
as set in the UI, is injected into nothing, and the failure is indistinguishable
from never having set it.

Confirmed by querying the deployment:

INGESTION_GCP_CREDENTIALS_JSON   locations=['OcotilloAPI']     ← never injected
INGESTION_GCS_BUCKET             locations=[]                   ← deployment-wide, works
DIVERHUB_USERNAME                locations=[]                   ← deployment-wide, works

The variables set before I removed --global were fine all along. Only what
came after was affected — the credential, and PYTHONPATH.

code_location_name in [tool.dg.project] looks like it should fix this and is
ignored for this command; I tried it, confirmed dg still reported "location
OcotilloAPI", and removed it rather than leaving a setting that does nothing.

The trade

Back to --global. That is broader than I would like — this deployment also
hosts aqueduct_dagster_defs_definitions and die-orchestration, which can now
read these values. The alternative is scoping in the Dagster+ UI against the
correct location name, which the script now says explicitly.

I removed --global in the first place to keep credentials off a shared
deployment, which was the right instinct and the wrong mechanism. A credential
the container cannot read is worth less than one scoped more broadly than ideal,
but the cost is recorded rather than traded away silently.

To finish

Re-set the credential at deployment scope:

uv run --with dagster-dg-cli dg plus create env INGESTION_GCP_CREDENTIALS_JSON --from-local-env --scope full --scope branch --global -y

PYTHONPATH is already re-set. Environment variables apply on the next run, so
no rebuild is needed.

🤖 Generated with Claude Code

jirhiker and others added 2 commits August 18, 2026 20:35
…e container

Dropping --global scoped variables to `OcotilloAPI` -- the project name -- rather
than to `ocotillo-automated-ingestion`, the name in dagster_cloud.yaml. Dagster+
accepts the unknown location without complaint, so INGESTION_GCP_CREDENTIALS_JSON
appeared correctly set in the UI while the container never received it, and the
asset kept failing with DefaultCredentialsError as though no key had been set.

`code_location_name` in [tool.dg.project] looks like the fix and is ignored for
this command, so that avenue is closed and the attempt is not left in the file.

Back to --global, which is broader than ideal: this deployment also hosts
aqueduct_dagster_defs_definitions and die-orchestration, which can read these
values. That is a real cost, recorded in the script along with the alternative --
scoping in the Dagster+ UI against the correct location name -- rather than
traded away silently. A credential the container cannot read is worth less than
one scoped more broadly than we would like.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CLOUD_SQL_INSTANCE_NAME was set to `dataservices`, which every layer accepts
until the connector tries to use it and raises a ValueError from inside the
driver, well below anything this project wrote. The connector wants the full
connection name, PROJECT:REGION:INSTANCE.

The script now checks the shape before setting it, and points at the gcloud
command that prints the right value.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

79.27% total — gate is 75%.

1 similar comment
@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Coverage

79.27% total — gate is 75%.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Your pull request is automatically being deployed to Dagster Cloud.

Location Status Link Updated
ocotillo-automated-ingestion View in Cloud Aug 19, 2026 at 03:47 AM (UTC)

@jirhiker
jirhiker merged commit 773de45 into staging Aug 19, 2026
10 checks passed
@jirhiker
jirhiker deleted the fix/dg-code-location-scope branch August 19, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant