nextとwebsocketをつかったssrのアプリケーションをnetlifyにデプロイしようとした。
ssr環境のアプリケーションをnetlifyにデプロイするには
next build && next export
を実行する必要があるとのこと。
参考:https://qiita.com/7ma7X/items/f8001f7ebac7862477e1
で、いざ実行して見ると、 next export
の実行が終わらない状態になった。
websocketの通信がサーバー側と常時繋がった状態になってプロセスが終了しないため、 next export
の実行が終わらないような感じだった。
next export
の実行が終わらないため、netlifyでのデプロイも一向に進まない。そのため、netlifyでのデプロイは諦めて now
を使うことにした。
next export
の実行が終わらない状態になったら Ctrl+c でキャンセルし、バンドルされたファイルが吐かれたディレクトリを対象に now
を実行
$ now dist/ -n gomoku-narabe
> WARN! Your project is missing a now.json file with a `version` property. More: https://zeit.co/docs/version-config
> WARN! You are using an old version of the Now Platform. More: https://zeit.co/docs/v1-upgrade
> Deploying ~/practice/kurohige-front/dist under tomohirosoga
> Using project gomoku-narabe
> Your deployment's code and logs will be publicly accessible because you are subscribed to the OSS plan.
> NOTE: You can use `now --public` or upgrade your plan to skip this prompt. More: https://zeit.co/account/plan
> Using project gomoku-narabe
> Synced 6 files (13.7KB) [1s]
> https://gomoku-narabe-bgoceldxyg.now.sh [v1] [in clipboard] [2s]
> Deployment complete!
$
デプロイできた。