ECMaker / blog

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

bug / #51 Netlifyの無料枠を超える:画像更新 #56

Closed u-ecmaker closed 6 months ago

u-ecmaker commented 6 months ago

bug / #51 Netlifyの無料枠を超える:画像更新

51 fix

色々テストして荒れている前のPR(deleted) : #54

features

Updated

ハマったところ

各ステップで全部。各駅停車。。
参考文献が見つかってよかった。

参考文献

  1. GitHub Actions の導入、ボタン実行の仕方 https://takusan.negitoro.dev/posts/github_actions/
  2. 定期実行の仕方
    https://enu23456.hatenablog.com/entry/2022/11/17/201001
  3. 定期実行コマンド cron の確認
    https://crontab.guru/#*/55_*_*_*_*
  4. Netlifyの無料枠を使ってしまうIssueのイントロ
    https://blog.70-10.net/posts/github-actions-deploy-netlify/
  5. NetlifyのID、Tokenの取得方法、build止め方
    https://zenn.dev/wintyo/articles/9861799eb845e3
  6. Actionsの主なコード参照元
    https://blog.tubone-project24.xyz/2021/02/13/netlify-github-action
  7. Page Not Foundの対策パッケージ導入方法
    https://www.hi1t0.com/blog/20220405/nextjs-github-actions-netlify/
  8. Netlifyパッケージ公式リファレンス
    https://paulonteri.com/thoughts/how-to/deploy-nextjs-to-netlify-manually
  9. GitHub Copilot genarated
    curl -X Post できない問題のコード

根本解決

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

github-actions[bot] commented 6 months ago

​ Netlify Build
──────────────────────────────────────────────────────────────── ​ ❯ Version @netlify/build 29.36.1 ​ ❯ Flags {} ​ ❯ Current directory /home/runner/work/blog/blog ​ ❯ Config file No config file was defined: using default values. ​ ❯ Context dev ​ ❯ Using Next.js Runtime - v4.41.3 ​ @netlify/plugin-nextjs (onPreBuild event)
──────────────────────────────────────────────────────────────── ​ No Next.js cache to restore. ​ (@netlify/plugin-nextjs onPreBuild completed in 1s) ​ Build command from Netlify app
──────────────────────────────────────────────────────────────── ​ $ npm run build

ecmaker@0.1.0 build next build

info - Linting and checking validity of types...

./src/hooks/apiHooks/fetcher.ts 36:28 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any 49:29 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

./src/server/utils/algolia.ts 20:45 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

./src/utils/storage.ts 9:53 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules info - Creating an optimized production build... info - Compiled successfully info - Collecting page data... info - Generating static pages (0/31) MyInputFileListComponent inputFiles null MyInputFileComponent inputFiles [] MyInputMultiFileListComponent inputFiles null MyInputMultiFileListControlComponent inputFiles null info - Generating static pages (7/31) info - Generating static pages (15/31) info - Generating static pages (23/31) info - Generating static pages (31/31) info - Finalizing page optimization...

Route (pages) Size First Load JS ┌ ● / (ISR: 1 Seconds) 1.85 kB 167 kB ├ /_app 0 B 165 kB ├ ○ /404 480 B 165 kB ├ λ /api/auth/[...nextauth] 0 B 165 kB ├ λ /api/hello 0 B 165 kB ├ λ /api/notion-blog/comments 0 B 165 kB ├ λ /api/notion-blog/likes/[page_id] 0 B 165 kB ├ ℇ /api/notion-blog/og 0 B 165 kB ├ λ /api/ogp 0 B 165 kB ├ ○ /contact 6.23 kB 298 kB ├ ○ /login 1.99 kB 167 kB ├ ● /posts (ISR: 1 Seconds) (829 ms) 16.7 kB 212 kB ├ ● /posts/[slug] (ISR: 1 Seconds) (25316 ms) 25.7 kB 370 kB ├ ├ /posts/notion-blog_google-analytics (3387 ms) ├ ├ /posts/RDP_remote-desktop (3384 ms) ├ ├ /posts/notion-blog_image-size (2383 ms) ├ ├ /posts/schedule-git (2003 ms) ├ ├ /posts/nodejs_npm-audit-fix (1773 ms) ├ ├ /posts/next.js_TipTap_plugin (1769 ms) ├ ├ /posts/relocation (1563 ms) ├ └ [+9 more paths] (avg 1006 ms) ├ ● /profile 2.02 kB 228 kB ├ ● /sandbox 829 B 196 kB ├ ○ /sandbox/input-file-list 1.54 kB 223 kB ├ ○ /sandbox/react-hook-form 21.3 kB 242 kB ├ ○ /sandbox/react-memo 857 B 222 kB ├ ○ /sandbox/react-use-memo 699 B 222 kB ├ ○ /sandbox/rive 24.4 kB 245 kB ├ ○ /sandbox/svgr 2.09 kB 223 kB └ ○ /sandbox/swr 1.04 kB 228 kB

ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components) λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps)

​ (build.command completed in 1m 3s) ​ @netlify/plugin-nextjs (onBuild event)
──────────────────────────────────────────────────────────────── ​ NextAuth package detected, NEXTAUTH_URL environment variable set by user in Netlify configuration to https://blog.ec-maker.com Moving static page files to serve from CDN... Moved 15 files to CDN The following routes use "revalidate" values of under 60 seconds, which is not supported. They will use a revalidate time of 60 seconds instead. ┌─────────┬─────────────────────────────────────────────┬────────────┐ │ (index) │ Route │ Revalidate │ ├─────────┼─────────────────────────────────────────────┼────────────┤ │ 0 │ '/' │ 1 │ │ 1 │ '/posts' │ 1 │ │ 2 │ '/posts/notion-blog_getting-started' │ 1 │ │ 3 │ '/posts/test-pr-review-deploy' │ 1 │ │ 4 │ '/posts/notion-blog_image-issue' │ 1 │ │ 5 │ '/posts/notion-blog_image-size' │ 1 │ │ 6 │ '/posts/RDP_remote-desktop' │ 1 │ │ 7 │ '/posts/logo' │ 1 │ │ 8 │ '/posts/relocation' │ 1 │ │ 9 │ '/posts/notion-blog_google-analytics' │ 1 │ │ 10 │ '/posts/BI_seikika' │ 1 │ │ 11 │ '/posts/next.js_TipTap_plugin' │ 1 │ │ 12 │ '/posts/nodejs_npm-audit-fix' │ 1 │ │ 13 │ '/posts/notion-blog_netlify-deploy-methods' │ 1 │ │ 14 │ '/posts/icon' │ 1 │ │ 15 │ '/posts/schedule-git' │ 1 │ │ 16 │ '/posts/github-pr-auto-branch' │ 1 │ │ 17 │ '/posts/openAI-API' │ 1 │ └─────────┴─────────────────────────────────────────────┴────────────┘ You are not using Netlify Edge Functions for image format detection. Set env var "NEXT_FORCE_EDGE_IMAGES=true" to enable. ✨ Deploying middleware and functions to Netlify Edge Functions ✨ ​ (@netlify/plugin-nextjs onBuild completed in 1.5s) ​ Functions bundling
──────────────────────────────────────────────────────────────── ​ Packaging Functions from .netlify/functions-internal directory:

Build logs: https://app.netlify.com/sites/blog-ecmaker/deploys/65e5300cdd2735067ee185fa Function logs: https://app.netlify.com/sites/blog-ecmaker/functions?scope=deploy:65e5300cdd2735067ee185fa Website draft URL: https://65e5300cdd2735067ee185fa--blog-ecmaker.netlify.app

If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag. netlify deploy --build --prod

github-actions[bot] commented 6 months ago

​ Netlify Build
──────────────────────────────────────────────────────────────── ​ ❯ Version @netlify/build 29.36.1 ​ ❯ Flags {} ​ ❯ Current directory /home/runner/work/blog/blog ​ ❯ Config file No config file was defined: using default values. ​ ❯ Context dev ​ ❯ Using Next.js Runtime - v4.41.3 ​ @netlify/plugin-nextjs (onPreBuild event)
──────────────────────────────────────────────────────────────── ​ No Next.js cache to restore. ​ (@netlify/plugin-nextjs onPreBuild completed in 691ms) ​ Build command from Netlify app
──────────────────────────────────────────────────────────────── ​ $ npm run build

ecmaker@0.1.0 build next build

info - Linting and checking validity of types...

./src/hooks/apiHooks/fetcher.ts 36:28 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any 49:29 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

./src/server/utils/algolia.ts 20:45 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

./src/utils/storage.ts 9:53 Warning: Unexpected any. Specify a different type. @typescript-eslint/no-explicit-any

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules info - Creating an optimized production build... info - Compiled successfully info - Collecting page data... info - Generating static pages (0/31) MyInputFileListComponent inputFiles null MyInputFileComponent inputFiles [] MyInputMultiFileListComponent inputFiles null MyInputMultiFileListControlComponent inputFiles null info - Generating static pages (7/31) info - Generating static pages (15/31) info - Generating static pages (23/31) info - Generating static pages (31/31) info - Finalizing page optimization...

Route (pages) Size First Load JS ┌ ● / (ISR: 1 Seconds) 1.85 kB 167 kB ├ /_app 0 B 165 kB ├ ○ /404 480 B 165 kB ├ λ /api/auth/[...nextauth] 0 B 165 kB ├ λ /api/hello 0 B 165 kB ├ λ /api/notion-blog/comments 0 B 165 kB ├ λ /api/notion-blog/likes/[page_id] 0 B 165 kB ├ ℇ /api/notion-blog/og 0 B 165 kB ├ λ /api/ogp 0 B 165 kB ├ ○ /contact 6.23 kB 298 kB ├ ○ /login 1.99 kB 167 kB ├ ● /posts (ISR: 1 Seconds) (641 ms) 16.7 kB 212 kB ├ ● /posts/[slug] (ISR: 1 Seconds) (26190 ms) 25.7 kB 370 kB ├ ├ /posts/RDP_remote-desktop (4598 ms) ├ ├ /posts/notion-blog_google-analytics (3845 ms) ├ ├ /posts/relocation (2365 ms) ├ ├ /posts/notion-blog_netlify-deploy-methods (2288 ms) ├ ├ /posts/BI_seikika (1803 ms) ├ ├ /posts/nodejs_npm-audit-fix (1572 ms) ├ ├ /posts/logo (1321 ms) ├ └ [+9 more paths] (avg 933 ms) ├ ● /profile 2.02 kB 228 kB ├ ● /sandbox 829 B 196 kB ├ ○ /sandbox/input-file-list 1.54 kB 223 kB ├ ○ /sandbox/react-hook-form 21.3 kB 242 kB ├ ○ /sandbox/react-memo 857 B 222 kB ├ ○ /sandbox/react-use-memo 699 B 222 kB ├ ○ /sandbox/rive 24.4 kB 245 kB ├ ○ /sandbox/svgr 2.09 kB 223 kB └ ○ /sandbox/swr 1.04 kB 228 kB

ℇ (Streaming) server-side renders with streaming (uses React 18 SSR streaming or Server Components) λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) (ISR) incremental static regeneration (uses revalidate in getStaticProps)

​ (build.command completed in 1m 5.9s) ​ @netlify/plugin-nextjs (onBuild event)
──────────────────────────────────────────────────────────────── ​ NextAuth package detected, NEXTAUTH_URL environment variable set by user in Netlify configuration to https://blog.ec-maker.com Moving static page files to serve from CDN... Moved 15 files to CDN The following routes use "revalidate" values of under 60 seconds, which is not supported. They will use a revalidate time of 60 seconds instead. ┌─────────┬─────────────────────────────────────────────┬────────────┐ │ (index) │ Route │ Revalidate │ ├─────────┼─────────────────────────────────────────────┼────────────┤ │ 0 │ '/' │ 1 │ │ 1 │ '/posts' │ 1 │ │ 2 │ '/posts/notion-blog_getting-started' │ 1 │ │ 3 │ '/posts/test-pr-review-deploy' │ 1 │ │ 4 │ '/posts/notion-blog_image-issue' │ 1 │ │ 5 │ '/posts/notion-blog_image-size' │ 1 │ │ 6 │ '/posts/RDP_remote-desktop' │ 1 │ │ 7 │ '/posts/logo' │ 1 │ │ 8 │ '/posts/relocation' │ 1 │ │ 9 │ '/posts/notion-blog_google-analytics' │ 1 │ │ 10 │ '/posts/BI_seikika' │ 1 │ │ 11 │ '/posts/next.js_TipTap_plugin' │ 1 │ │ 12 │ '/posts/nodejs_npm-audit-fix' │ 1 │ │ 13 │ '/posts/notion-blog_netlify-deploy-methods' │ 1 │ │ 14 │ '/posts/icon' │ 1 │ │ 15 │ '/posts/schedule-git' │ 1 │ │ 16 │ '/posts/github-pr-auto-branch' │ 1 │ │ 17 │ '/posts/openAI-API' │ 1 │ └─────────┴─────────────────────────────────────────────┴────────────┘ You are not using Netlify Edge Functions for image format detection. Set env var "NEXT_FORCE_EDGE_IMAGES=true" to enable. ✨ Deploying middleware and functions to Netlify Edge Functions ✨ ​ (@netlify/plugin-nextjs onBuild completed in 1.2s) ​ Functions bundling
──────────────────────────────────────────────────────────────── ​ Packaging Functions from .netlify/functions-internal directory:

Build logs: https://app.netlify.com/sites/blog-ecmaker/deploys/65e53c32ffad920c51180337 Function logs: https://app.netlify.com/sites/blog-ecmaker/functions?scope=deploy:65e53c32ffad920c51180337 Website draft URL: https://65e53c32ffad920c51180337--blog-ecmaker.netlify.app

If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag. netlify deploy --build --prod