ECMaker / blog

https://blog.ec-maker.com/
0 stars 0 forks source link

Netlifyの無料枠デプロイ総時間をこえてしまう:画像URLリンク切れ問題が再燃 #51

Closed u-ecmaker closed 6 months ago

u-ecmaker commented 6 months ago

from #49

対策案

  1. Netlifyに7ドル支払った話

    300 分を超えた時点で請求が発生する ビルド時間が 300 分に達すると利用できなくなるわけではありません。 自動で 7 ドルの課金処理を行い、500 分のビルド時間がプラスされます。

  2. Notion API 画像URLの期限切れ対策を3つ紹介する
  3. Notion APIとNext.jsでヘッドレスCMSなブログを作る

    ひとまず、自分はSSRする方向にしたのがこちらのコミット
    ただ一度、ISR による高速なデータフェッチを体験すると、SSRはとてもツライ…

u-ecmaker commented 6 months ago

51 対策案1.のアプローチでfixを目指す

  1. Netlifyに7ドル支払った話

    300 分を超えた時点で請求が発生する ビルド時間が 300 分に達すると利用できなくなるわけではありません。 自動で 7 ドルの課金処理を行い、500 分のビルド時間がプラスされます。

Actions上でbuildは走ったけど、順調にエラる。
image

u-ecmaker commented 6 months ago

Chat GPT generated

Run npm install
  npm install
  shell: /usr/bin/bash -e {0}
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/[2](https://github.com/ECMaker/blog/actions/runs/8120543351/job/22197895413#step:4:2)024-0[3](https://github.com/ECMaker/blog/actions/runs/8120543351/job/22197895413#step:4:3)-02T0[5](https://github.com/ECMaker/blog/actions/runs/8120543351/job/22197895413#step:4:6)_05_21_[6](https://github.com/ECMaker/blog/actions/runs/8120543351/job/22197895413#step:4:7)35Z-debug-0.log
Error: Process completed with exit code 1.

image

u-ecmaker commented 6 months ago

環境変数を設定したら buildまで通った!!

image

u-ecmaker commented 6 months ago

できた!

けど、、Netlify側だと何も表示されていない。。本当に出来てるのか?

まずNetlifyの自動デプロイを無効化 image

そして Notion の方を更新して、RUNさせる、、果たして、、、 image

出来た!!

出来たと思っていたら出来ていなかった

また画像がリンク切れになっていた。。。
image

Publish でエラー
1m 34s
5m 5s
Warning: Unexpected input(s) 'env', 'NETLIFY_SITE_ID', 'NETLIFY_AUTH_TOKEN', valid inputs are ['entryPoint', 'args']
Run netlify/actions/cli@master
/usr/bin/docker run --name cc580cbe0ec600ec[1](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:1)34233976b0cd7407c7f95_c1fb89 --label cc580c --workdir /github/workspace --rm -e "INPUT_ARGS" -e "INPUT_ENV" -e "INPUT_NETLIFY_SITE_ID" -e "INPUT_NETLIFY_AUTH_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/blog/blog":"/github/workspace" cc580c:be0ec600ec134233976b0cd7407c7f95 deploy --dir=public --prod
- Waiting for authorization...
 ›   Error: Timed out waiting for authorization. If you do not have a Netlify account, please create one at https://app.netlify.com/signup, then run netlify login again.
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/[2](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:2)022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Logging into your Netlify account...
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=5[7](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:8)0965a63224[8](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:9)d2bc0fbcf76c0850b53
---------------------------
Error: Unable to open browser automatically: Running inside a docker container
Please open your browser and open the URL below:
https://app.netlify.com/authorize?response_type=ticket&ticket=570[9](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:10)65a632248d2bc0fbcf76c0850b53
---------------------------
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-[10](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:11)-11-github-actions-deprecating-save-state-and-set-output-commands/
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
https://app.netlify.com/authorize?response_type=ticket
Warning: The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-[11](https://github.com/ECMaker/blog/actions/runs/8125722785/job/22208659980#step:8:12)-github-actions-deprecating-save-state-and-set-output-commands/
u-ecmaker commented 6 months ago

PR用の Actions も作成

参考 Netlifyのビルド時間をGitHub Actionsで0時間にして月末のヒヤヒヤから解放されよう!

→ PR作成で本当にActionsが走った。はたしてbuildは通るのか、、、 image

すごい、通った! Previewサイトのコメントも来ている。
image
けど、Previewサイトを開くと NotFound
image

こちらも参考 GitHub ActionsでNetlifyにデプロイする NETLIFY_SITE_ID_DEV も必要!

これかも! https://www.hi1t0.com/blog/20220405/nextjs-github-actions-netlify/ https://paulonteri.com/thoughts/how-to/deploy-nextjs-to-netlify-manually

u-ecmaker commented 5 months ago

根本解決

buildしまくるのはやめたいとき、参考になりそう https://tech-sora.vercel.app/articles/notion-next-blog2