📘

dataform@2.9.0で変なログが出る問題

に公開

事象

なぜかdataformコマンドを実行すると変なログが出る。

~/test$ dataform
{"level":"INFO","message":"[2:04:09.581 PM]: Configuring logger with level: 2, filePath: undefined, additionalLogToConsole: undefined"}
dataform [command]

Commands:
  dataform help [command]                                 Show help. If [command] is specified, the help is for the given command.
  dataform init <warehouse> [project-dir]                 Create a new dataform project.
...

環境

~/test$ node --version
v18.19.0
~/test$ npm --version
9.2.0
~/test$ dataform --version
{"level":"INFO","message":"[2:44:51.615 PM]: Configuring logger with level: 2, filePath: undefined, additionalLogToConsole: undefined"}
2.9.0
~/test$ npm list
test@ /home/mokeminecraft/test
└── @dataform/core@2.9.0

調査

関連がありそうなGitHub Issueは以下の通り
https://github.com/dataform-co/dataform/issues/1883
https://github.com/snowflakedb/snowflake-connector-nodejs/issues/794
https://github.com/snowflakedb/snowflake-connector-nodejs/issues/957

原因

どうも@dataform/cliの依存ライブラリとしてインストールされるsnowflake-sdkのver1.15.0で問題が起きているらしい。
確かにver1.15.0がインストールされている。

~/test$ npm list -g snowflake-sdk
/usr/local/lib
└─┬ @dataform/cli@2.9.0
  └── snowflake-sdk@1.15.0

snowflakeのissueではエラーを起こさないおまじないが紹介されているが、我々はCLIから使いたいのでこの方法は取れない。
そこで、snowflake-sdkのバージョンを下げる。

対応

  1. 既存のDataform CLIをアンインストール:sudo npm uninstall -g @dataform/cli
  2. snowflakeのバージョンを下げた状態で再インストール:sudo npm install -g snowflake-sdk@1.14.0 @dataform/cli@2.9.0
  3. snowflakeのバージョンを確認:npm list -g snowflake-sdk
  4. dataformコマンドを実行してもログが出ないことの確認:dataform --version
~/test$ sudo npm uninstall -g @dataform/cli

removed 590 packages in 3s
~/test$ sudo npm install -g snowflake-sdk@1.14.0 @dataform/cli@2.9.0
npm WARN deprecated @aws-sdk/node-http-handler@3.374.0: This package has moved to @smithy/node-http-handler
npm WARN deprecated google-p12-pem@3.1.4: Package is no longer maintained
npm WARN deprecated vm2@3.9.19: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
npm WARN deprecated @azure/core-http@3.0.5: This package is no longer supported. Please refer to https://github.com/Azure/azure-sdk-for-js/blob/490ce4dfc5b98ba290dee3b33a6d0876c5f138e2/sdk/core/README.md

added 701 packages in 26s

109 packages are looking for funding
  run `npm fund` for details
~/test$ npm list -g snowflake-sdk
/usr/local/lib
├─┬ @dataform/cli@2.9.0
│ └── snowflake-sdk@1.14.0 deduped
└── snowflake-sdk@1.14.0

~/test$ dataform --version
2.9.0

Discussion