Skip to content

feat: add support for service account impersonation - #2001

Merged
kolina merged 3 commits into
dataform-co:mainfrom
ashish10alex:fix/imper
Jan 5, 2026
Merged

feat: add support for service account impersonation#2001
kolina merged 3 commits into
dataform-co:mainfrom
ashish10alex:fix/imper

Conversation

@ashish10alex

@ashish10alexashish10alex commented Aug 6, 2025

Copy link
Copy Markdown
Contributor

Fixes: #2000

Solution:

Update @google-cloud/bigquery to a newer version which supports service account impersonation. The version number (~7.1.1) was set from finding the maximum version of @google-cloud/bigquery such that current minimum Node JS version (16.6.0) does not need to be changed.

Tests

  1. Able to create .df-credentials.json after authenticating to service account to impersonate by running the following. Earlier to would throw an error: The incoming JSON object does not contain a client_email field
gcloud auth application-default login --impersonate-service-account=<service-account-here>
CleanShot 2025-08-06 at 16 15 31@2x
  1. Able to do dataform run with the impersonated service account
CleanShot 2025-08-06 at 16 17 02@2xCleanShot 2025-08-06 at 16 18 09@2x
  1. bazel test //core/... & ./scripts/lint passes

@ashish10alex
ashish10alex requested a review from a team as a code ownerAugust 6, 2025 15:25
@ashish10alex
ashish10alex requested review from kolina and removed request for a teamAugust 6, 2025 15:25
Comment threadpackage.json Outdated
"@bazel/rollup": "^3.0.0",
"@bazel/typescript": "^3.0.0",
"@google-cloud/bigquery": "^5.6.0",
"@google-cloud/bigquery": "7.1.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it shouldn't be pinned to a specific version similar to other dependencies

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kolina for the review. Using ^7.1.1 results in the following error when doing bazel run @nodejs//:yarn add @google-cloud/bigquery@^7.1.1

error @google-cloud/promisify@4.1.0: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.16.0"

However, we can use ~ to allow patch updates only (minor and major fixed). This installs without any issues. I have made this change in the lates commit.

Happy to change based on feedback. Trying a lower major version is another option.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ceridan, can you please take a look here?

@kolina
kolina requested a review from CeridanAugust 8, 2025 00:16

@CeridanCeridan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we need to put it on hold for a while. We cannot easily upgrade to @google-cloud/bigquery@7.1.1 because it is not available on our npm mirror at the moment.

Additionally, there is a an ongoing work to update the whole toolchain for Dataform which will make it possible to upgrade NodeJS version and other dependencies to up to date versions.

@wintermi

Copy link
Copy Markdown

Any further updates on when this will be merged?

@Ceridan

Copy link
Copy Markdown
Contributor

Unfortunately, we cannot merge this right now. It is required some additional work on build toolchain upgrade, which allows us to upgrade all the dependencies. This work will most likely be done in Q4'2025.

@kolina

Copy link
Copy Markdown
Contributor

@ashish10alex, can you please sync this PR to the latest main? After this I'll re-run tests and if they're successful, I'll merge this PR.

@ashish10alex

Copy link
Copy Markdown
ContributorAuthor

@ashish10alex, can you please sync this PR to the latest main? After this I'll re-run tests and if they're successful, I'll merge this PR.

@kolina done

@kolina

Copy link
Copy Markdown
Contributor

/gcbrun

@kolina
kolina merged commit c7441bf into dataform-co:mainJan 5, 2026
2 checks passed
@mganeshphani

mganeshphani commented Jan 6, 2026

Copy link
Copy Markdown

@kolina thankyou for getting this in.. when can we expect a new release with this fix?

@kolina

Copy link
Copy Markdown
Contributor

It's included into this release

@mganeshphani

Copy link
Copy Markdown

Thankyou @kolina .. we will try it.. appreciate getting this one out asap

Sign up for freeto 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.

Dataform CLI ignores impersonation

5 participants

@ashish10alex@wintermi@Ceridan@kolina@mganeshphani