Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform CLI Compile Fails with ReferenceError.

Hi,

I have a dataform project which compiles successfully in the gcp UI.

However, when I try to run `dataform compile` locally on the same project, I am getting multiple `ReferenceError`s which seem to be connected to javascript strict mode.

an example for code that succeeds in the UI but fails locally:

define a `.js` file under `includes` folder  with a variable:

VAR_NAME = "foo";

this compiles successfully in the UI but locally errors with `ReferenceError: VAR_NAME is not defined`

I am using `"@dataform/cli": "^2.0.4"` and `"@dataform/core": "2.8.0"`

1 4 443
4 REPLIES 4


In the GCP UI, JavaScript strict mode might not be enforced, allowing the code to run without declaring variables. Locally, strict mode is likely enforced, requiring you to declare variables with let, const, or var. Update your code to:

const VAR_NAME = "foo";

This should resolve the ReferenceError.

I can't really update the code as it belongs to a client
is there a different way to make it run locally?

Hi @Elisheva,

Welcome to Google Cloud Community!

To isolate the issue, you can also try to update the dataformCoreVersion in workflow_settings.yaml file, then re-run NPM install:

npm i

 To update the Dataform CLI tool, run the following command:

npm i -g @dataform/cli@^3.0.0-beta.2

You can also check the Dataform release notes to keep you updated for the new or latest features, bug fixes, known issues, and deprecated functionality.

I hope the above information is helpful.


 

Hi

this issue happens on the latest dataform version