LoginSignup
1
0

pnpmを使ったプロジェクトでCloudFunctionsがデプロイできなくなるバグの解決策

Posted at

こんにちは。virapture株式会社でCEOしながらラグナロク株式会社でもCKOとして働いている@mogmetです。

本日はトラブルシュート記事になります。

現象

ある日突然下記のエラーと共に、cloud functionsがデプロイできなくなりました。

Step #2 - "build": ===> BUILDING
Step #2 - "build": Timer: Builder started at 2023-12-20T00:27:53Z
Step #2 - "build": === Node.js - Runtime (google.nodejs.runtime@1.0.0) ===
Step #2 - "build": Using runtime version from GOOGLE_RUNTIME_VERSION: 18.18.2
Step #2 - "build": ***** CACHE HIT: "nodejs"
Step #2 - "build": Node.js v18.18.2 cache hit, skipping installation.
Step #2 - "build": === Utils - Archive Source (google.utils.archive-source@0.0.1) ===
Step #2 - "build": Adding image label google.source-archive: /workspace/.googlebuild/source-code.tar.gz
Step #2 - "build": === Node.js - Pnpm (google.nodejs.pnpm@0.1.0) ===
Step #2 - "build": 2023/12/20 00:27:53 [DEBUG] GET https://registry.npmjs.org/pnpm
Step #2 - "build": ***** CACHE MISS: "pnpm_engine"
Step #2 - "build": Installing pnpm v8.13.0
Step #2 - "build": 2023/12/20 00:27:54 [DEBUG] GET https://github.com/pnpm/pnpm/releases/download/v8.13.0/pnpm-linux-x64
Step #2 - "build": --------------------------------------------------------------------------------
Step #2 - "build": failed to build: (error ID: a7b84d14):
Step #2 - "build": installing pnpm: (error ID: d089d270):
Step #2 - "build": downloading pnpm: (error ID: 484d23ae):
Step #2 - "build": fetching https://github.com/pnpm/pnpm/releases/download/v8.13.0/pnpm-linux-x64 returned HTTP status: 404
Step #2 - "build": Timer: Builder ran for 547.305417ms and ended at 2023-12-20T00:27:54Z
Step #2 - "build": ERROR: failed to build: exit status 1

原因

2023/12/20現在、pnpmの最新版は8.12.1なのですが、なぜかCloudFunctionsのビルド時には8.13.0をインストールしようとしています。
未来に生き急いでいます。
pnpmがインストールできないためビルドがこけていることがわかります。

対策

package.jsonのpnpmのengine指定では下記のように指定していました。

...
 "engines": {
    "pnpm": ">=8.5.0",
    "node": "18",
...

これを下記のようにバージョン指定するように修正しました。

...
  "engines": {
    "pnpm": "8.12.1",
    "node": "18",
...

無事にデプロイできるようになりました。

まとめ

latestを指定していると突然動かなくなるのでバージョン指定するようにしましょう!!

最後に、スノボの楽しく滑るコツを掴める cotsume というアプリを作ってます!よかったらDLしてみてね!

また、ワンナイト人狼オンラインというゲームを作ってます!よかったら遊んでね!

他にもCameconOffcha、問い合わせ対応が簡単にできるCSmart、フリーランスのコミュニティのNextFreelanceといったサービスも作ってるのでよかったら使ってね!

また、チームビルディングや技術顧問、Firebaseの設計やアドバイスといったお話も受け付けてますので御用の方は弊社までお問い合わせください。

ラグナロクでもエンジニアやデザイナーのメンバーを募集しています!!楽しくぶち上げたい人はぜひお話ししましょう!!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0