Skip to content

[BUG] dbt Platform teams miss DBT_CLOUD_INVOCATION_CONTEXT env var and more in local development #688

@boxysean

Description

@boxysean

Describe the bug
I'm working with two teams who have been using either the dbt Cloud CLI or dbt Studio IDE and testing out dbt Fusion. I have two similar cases:

  1. One team has dbt macros that use DBT_CLOUD_INVOCATION_CONTEXT environment variable to set targets and warehouses.
  2. A second team usually uses dbt Studio IDE set their own custom variables: DBT_SOURCE_DB, DBT_PREP_DB, etc. that they use in dbt_project.yml. When they tried out dbt Fusion on VSCode, they expected that their dbt Platform env vars would be available to them, and in the interim created a .env file with variables -- but their preference is for these variables to be centrally managed.

In both cases, dbtf (in VSCode) does not recognize the environment variables from dbt Platform.

I've confirmed in dbt Studio with Fusion enabled that DBT_CLOUD_INVOCATION_CONTEXT is enabled. However, in local dev (VSCode) this variable does not appear to be set.

What version of dbt Fusion is this bug in? (find out by running dbt --version)
dbt-fusion 2.0.0-preview.7

Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.

  • YES
  • NO

To Reproduce

  • Add a model with contents select {{ env_var('DBT_CLOUD_INVOCATION_CONTEXT') }} as invo_context to a local dbt Fusion project in VSCode.
  • Observe the following error: dbt1501: Failed to render SQL invalid operation: 'env_var': environment variable 'DBT_CLOUD_INVOCATION_CONTEXT' not found

Expected behavior
Developers that use dbt Platform have the DBT_CLOUD_INVOCATION_CONTEXT environment variable available in their VSCode local development environment.

Operating System and CPU Type (please complete the following information):
Apple Silicon

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscePertains to the VS Code Extension / Language Server

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions