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 ReferenceErrors 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"
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:
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.