-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Automatic installation failure #8685
Conversation
apps/app/src/server/crowi/index.js
Outdated
@@ -503,6 +501,8 @@ Crowi.prototype.start = async function() { | |||
// Execute this asynchronously after the express server is ready so it does not block the ongoing process | |||
this.asyncAfterExpressServerReady(); | |||
|
|||
this.autoInstall(); | |||
|
|||
return serverListening; | |||
}; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
症状
auto install 時にエラーが出ていて自動生成されるはずの user が作成できていませんでした。cypress テストでログインが必要な操作はこれが原因で失敗しているようでした。
エラーログ
[2024-04-04T13:28:32.170Z] ERROR: growi:service:installer/3304 on fv-az1493-626: Http server has not attached yet.
Error: Http server has not attached yet.
at SocketIoService.getDefaultSocket (/home/runner/work/growi/growi/apps/app/dist/server/service/socket-io.js:45:19)
at PageService.emitUpdateDescCount (/home/runner/work/growi/growi/apps/app/dist/server/service/page/index.js:2784:51)
at PageService.updateDescendantCountOfAncestors (/home/runner/work/growi/growi/apps/app/dist/server/service/page/index.js:2781:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PageService.forceCreateBySystem (/home/runner/work/growi/growi/apps/app/dist/server/service/page/index.js:3204:9)
at async InstallerService.install (/home/runner/work/growi/growi/apps/app/dist/server/service/installer.js:99:13)
https://github.com/weseek/growi/actions/runs/8555429794/job/23442998304#step:17:168
原因
以下の処理で pageService.forceCreateBySystem
というメソッドを使っていおり、内部で socketIoService に依存しています。
growi/apps/app/src/server/service/installer.ts
Lines 131 to 133 in b8863fb
await this.createPage( | |
path.join(this.crowi.localeDir, globalLang, 'welcome.md'), | |
'/', |
依存している socketIoService の初期化処理よりも前に autoInstall() を実行していたことがバグの原因でした。
以下の PR で初回ページの作成ロジックが pageService.create()
から pageService.forceCreateBySystem()
に変更されていました。
https://github.com/weseek/growi/pull/8459/files#diff-8d6a6a68e7b9af0c58501e40918527ae36b391e965e1a850f37bc78ea7323c15R56
解決策
socketIoService の初期化、SocketIoService.attachServer() の実行後に autoInstall() するように修正しました。
apps/app/src/server/crowi/index.js
Outdated
@@ -503,6 +501,8 @@ Crowi.prototype.start = async function() { | |||
// Execute this asynchronously after the express server is ready so it does not block the ongoing process | |||
this.asyncAfterExpressServerReady(); | |||
|
|||
this.autoInstall(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listen する前にデータ作成完了させておきたい
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修正しました
✨✨ That's perfect, there is no visual difference! ✨✨ Check out the report here. |
Task
#138561 [VRT] 正常化残タスク
┗ #144073 Auto Install 時のエラー修正