Astro site deploy preview works before merging PR; after merge, deploy fails. The error seems to be caused by fetching data

Hi, I’m deploying an Astro site from the main branch of my repo. I opened a new branch to fetch GitHub repository data prior to building the static site pages. This worked in the local dev server, and when I opened a pull request to merge the branch into main, the deploy preview was successful: https://deploy-preview-72--vocal-crepe-66f9af.netlify.app/

Deploy preview build log:
10:38:31 AM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
10:38:31 AM: buildbot version: d4068f75b500fda01f8eb2592656f157c0c28aa7
10:38:31 AM: Fetching cached dependencies
10:38:31 AM: Starting to download cache of 178.7MB
10:38:33 AM: Finished downloading cache in 1.98s
10:38:33 AM: Starting to extract cache
10:38:34 AM: Finished extracting cache in 1.107s
10:38:34 AM: Finished fetching cache in 3.153s
10:38:34 AM: Starting to prepare the repo for build
10:38:34 AM: Preparing Git Reference pull/72/head
10:38:36 AM: Custom publish path detected. Proceeding with the specified path: “astro-tutorial/dist”
10:38:36 AM: manpath: warning: $PATH not set
10:38:36 AM: Starting to install dependencies
10:38:36 AM: Python version set to 3.8
10:38:36 AM: Attempting Ruby version 2.7.2, read from environment
10:38:37 AM: Using Ruby version 2.7.2
10:38:38 AM: Started restoring cached go cache
10:38:38 AM: Finished restoring cached go cache
10:38:38 AM: go version go1.19.13 linux/amd64
10:38:38 AM: Using PHP version 8.0
10:38:39 AM: Started restoring cached Node.js version
10:38:39 AM: Finished restoring cached Node.js version
10:38:40 AM: v18.19.0 is already installed.
10:38:40 AM: Now using node v18.19.0 (npm v10.2.3)
10:38:40 AM: Enabling Node.js Corepack
10:38:40 AM: Started restoring cached build plugins
10:38:40 AM: Finished restoring cached build plugins
10:38:40 AM: Started restoring cached corepack dependencies
10:38:40 AM: Finished restoring cached corepack dependencies
10:38:40 AM: No npm workspaces detected
10:38:40 AM: Started restoring cached node modules
10:38:40 AM: Finished restoring cached node modules
10:38:40 AM: Installing npm packages using npm version 10.2.3
10:38:43 AM: added 16 packages, changed 22 packages, and audited 614 packages in 2s
10:38:43 AM: 216 packages are looking for funding
10:38:43 AM: run npm fund for details
10:38:43 AM: found 0 vulnerabilities
10:38:43 AM: npm packages installed
10:38:43 AM: Successfully installed dependencies
10:38:43 AM: Starting build script
10:38:44 AM: Detected 1 framework(s)
10:38:44 AM: “astro” at version “4.2.4”
10:38:44 AM: Section completed: initializing
10:38:45 AM: ​
10:38:45 AM: Netlify Build
10:38:45 AM: ────────────────────────────────────────────────────────────────
10:38:45 AM: ​
10:38:45 AM: ❯ Version
10:38:45 AM: @netlify/build 29.32.4
10:38:45 AM: ​
10:38:45 AM: ❯ Flags
10:38:45 AM: baseRelDir: true
10:38:45 AM: buildId: 65b280752dd73700085be030
10:38:45 AM: deployId: 65b280752dd73700085be032
10:38:45 AM: ​
10:38:45 AM: ❯ Current directory
10:38:45 AM: /opt/build/repo/astro-tutorial
10:38:45 AM: ​
10:38:45 AM: ❯ Config file
10:38:45 AM: No config file was defined: using default values.
10:38:45 AM: ​
10:38:45 AM: ❯ Context
10:38:45 AM: deploy-preview
10:38:45 AM: ​
10:38:45 AM: Build command from Netlify app
10:38:45 AM: ────────────────────────────────────────────────────────────────
10:38:45 AM: ​
10:38:45 AM: $ npm run build
10:38:46 AM: > astro-tutorial@0.0.1 build
10:38:46 AM: > astro build
10:38:47 AM: 15:38:47 Types generated 360ms
10:38:47 AM: 15:38:47 [build] output: “static”
10:38:47 AM: 15:38:47 [build] directory: /opt/build/repo/astro-tutorial/dist/
10:38:47 AM: 15:38:47 [build] Collecting build info…
10:38:47 AM: 15:38:47 [build] ✓ Completed in 398ms.
10:38:47 AM: 15:38:47 [build] Building static entrypoints…
10:38:50 AM: 15:38:50 [astro-icon] Loaded icons from tabler
10:38:51 AM: 15:38:51 [build] ✓ Completed in 3.41s.
10:38:51 AM: building client (vite)
10:38:51 AM: 15:38:51 [vite] transforming…
10:38:53 AM: 15:38:53 [vite] ✓ 60 modules transformed.
10:38:53 AM: 15:38:53 [vite] rendering chunks…
10:38:53 AM: 15:38:53 [vite] computing gzip size…
10:38:53 AM: 15:38:53 [vite] dist/_astro/tagsStore.DabOtisG.js 0.34 kB │ gzip: 0.26 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/ToggleFilterMenuBtn.D4sZkOzJ.js 0.35 kB │ gzip: 0.26 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/ProjectCard.6TUrdkYf.js 1.09 kB │ gzip: 0.58 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/FilterMenu.QRndhvJ9.js 1.66 kB │ gzip: 0.86 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/index.b1Uj56Yn.js 1.73 kB │ gzip: 0.98 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/index.esm.7yq4e_WN.js 3.01 kB │ gzip: 1.00 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/index.UCAuQZPX.js 6.83 kB │ gzip: 2.72 kB
10:38:53 AM: 15:38:53 [vite] dist/_astro/client.2wOxL1Aq.js 135.32 kB │ gzip: 43.73 kB
10:38:53 AM: 15:38:53 [vite] ✓ built in 1.85s
10:38:53 AM: generating static routes
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/index.astro
10:38:53 AM: 15:38:53 └─ /index.html (+215ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/about.astro
10:38:53 AM: 15:38:53 └─ /about/index.html (+137ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/blog/index.astro
10:38:53 AM: 15:38:53 └─ /blog/index.html (+4ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/blog/[…slug].astro
10:38:53 AM: 15:38:53 └─ /blog/working-with-ossi-supported-projects/index.html (+7ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/documentation.astro
10:38:53 AM: 15:38:53 └─ /documentation/index.html (+3ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/ecosystems/index.astro
10:38:53 AM: 15:38:53 └─ /ecosystems/index.html (+17ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/ecosystems/[…slug].astro
10:38:53 AM: 15:38:53 └─ /ecosystems/imglib2/index.html (+6ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/projects/index.astro
10:38:53 AM: 15:38:53 └─ /projects/index.html (+14ms)
10:38:53 AM: 15:38:53 :arrow_forward: src/pages/projects/[…slug].astro
10:38:53 AM: 15:38:53 ├─ /projects/an-open-source-platform-for-single-molecule-localization/index.html (+5ms)
10:38:53 AM: 15:38:53 ├─ /projects/java-packaging-tool-chain/index.html (+5ms)
10:38:53 AM: 15:38:53 ├─ /projects/kilosort/index.html (+4ms)
10:38:53 AM: 15:38:53 ├─ /projects/paintera/index.html (+4ms)
10:38:53 AM: 15:38:53 └─ /projects/video-annotation-library/index.html (+4ms)
10:38:53 AM: 15:38:53 ✓ Completed in 481ms.
10:38:53 AM:
10:38:53 AM: generating optimized images
10:38:54 AM: 15:38:54 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_ZzWngM.webp (before: 8520kB, after: 6kB) (+605ms) (1/23)
10:38:54 AM: 15:38:54 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_ZpElnm.webp (before: 8520kB, after: 19kB) (+661ms) (2/23)
10:38:55 AM: 15:38:55 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_Z1qL3tQ.webp (before: 8520kB, after: 19kB) (+644ms) (3/23)
10:39:01 AM: 15:39:01 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_ZPDlNg.webp (before: 8520kB, after: 4763kB) (+5.54s) (4/23)
10:39:01 AM: 15:39:01 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_xjnP.webp (before: 8520kB, after: 19kB) (+644ms) (5/23)
10:39:02 AM: 15:39:02 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_ZfweRu.webp (before: 8520kB, after: 6kB) (+549ms) (6/23)
10:39:03 AM: 15:39:03 :arrow_forward: /_astro/f4pUuCc3M0g-unsplash.a4-eSE-O_Z5ecY4.webp (before: 8520kB, after: 19kB) (+626ms) (7/23)
10:39:03 AM: 15:39:03 :arrow_forward: /_astro/Bg0Geue-cY8-unsplash.K4LFZHz-_1xWpn9.webp (before: 4448kB, after: 13kB) (+332ms) (8/23)
10:39:03 AM: 15:39:03 :arrow_forward: /_astro/Bg0Geue-cY8-unsplash.K4LFZHz-_1Ifrgz.webp (before: 4448kB, after: 37kB) (+401ms) (9/23)
10:39:06 AM: 15:39:06 :arrow_forward: /_astro/Bg0Geue-cY8-unsplash.K4LFZHz-_Z1ayfgD.webp (before: 4448kB, after: 2412kB) (+3.08s) (10/23)
10:39:07 AM: 15:39:07 :arrow_forward: /_astro/Bg0Geue-cY8-unsplash.K4LFZHz-_1O1XDt.webp (before: 4448kB, after: 37kB) (+427ms) (11/23)
10:39:07 AM: 15:39:07 :arrow_forward: /_astro/OqtafYT5kTw-unsplash.24UAVp8K_Z1dOLet.webp (before: 1720kB, after: 16kB) (+150ms) (12/23)
10:39:07 AM: 15:39:07 :arrow_forward: /_astro/OqtafYT5kTw-unsplash.24UAVp8K_Z13wJl3.webp (before: 1720kB, after: 49kB) (+239ms) (13/23)
10:39:08 AM: 15:39:08 :arrow_forward: /_astro/OqtafYT5kTw-unsplash.24UAVp8K_1AuEGJ.webp (before: 1720kB, after: 854kB) (+1.10s) (14/23)
10:39:08 AM: 15:39:08 :arrow_forward: /_astro/OqtafYT5kTw-unsplash.24UAVp8K_ZWKcX9.webp (before: 1720kB, after: 49kB) (+226ms) (15/23)
10:39:10 AM: 15:39:10 :arrow_forward: /_astro/rmWtVQN5RzU-unsplash.ka33TXLp_5hHAd.webp (before: 2495kB, after: 945kB) (+1.93s) (16/23)
10:39:11 AM: 15:39:11 :arrow_forward: /_astro/rmWtVQN5RzU-unsplash.ka33TXLp_kDTu0.webp (before: 2495kB, after: 38kB) (+256ms) (17/23)
10:39:11 AM: 15:39:11 :arrow_forward: /_astro/rmWtVQN5RzU-unsplash.ka33TXLp_4zldF.webp (before: 2495kB, after: 12kB) (+187ms) (18/23)
10:39:11 AM: 15:39:11 :arrow_forward: /_astro/rmWtVQN5RzU-unsplash.ka33TXLp_eRn76.webp (before: 2495kB, after: 38kB) (+253ms) (19/23)
10:39:14 AM: 15:39:14 :arrow_forward: /_astro/jacob-miller-ot5kWZkH97s-unsplash.0kqyq9qL_2mOWGt.webp (before: 3285kB, after: 1467kB) (+2.52s) (20/23)
10:39:14 AM: 15:39:14 :arrow_forward: /_astro/jacob-miller-ot5kWZkH97s-unsplash.0kqyq9qL_ZUUAEj.webp (before: 3285kB, after: 44kB) (+296ms) (21/23)
10:39:14 AM: 15:39:14 :arrow_forward: /_astro/jacob-miller-ot5kWZkH97s-unsplash.0kqyq9qL_Zwdiph.webp (before: 3285kB, after: 15kB) (+222ms) (22/23)
10:39:14 AM: 15:39:14 :arrow_forward: /_astro/jacob-miller-ot5kWZkH97s-unsplash.0kqyq9qL_ZlUgvQ.webp (before: 3285kB, after: 44kB) (+294ms) (23/23)
10:39:14 AM: 15:39:14 ✓ Completed in 21.21s.
10:39:14 AM:
10:39:14 AM: 15:39:14 [build] 13 page(s) built in 27.44s
10:39:14 AM: 15:39:14 [build] Complete!
10:39:15 AM: Post processing - header rules
10:39:15 AM: Starting post processing
10:39:15 AM: Skipping form detection
10:39:15 AM: Post processing - redirect rules
10:39:15 AM: Post processing done
10:39:15 AM: Section completed: postprocessing
10:39:15 AM: ​
10:39:15 AM: (build.command completed in 29.2s)
10:39:15 AM: ​
10:39:15 AM: Deploy site
10:39:15 AM: ────────────────────────────────────────────────────────────────
10:39:15 AM: ​
10:39:15 AM: Starting to deploy site from “astro-tutorial/dist”
10:39:15 AM: Calculating files to upload
10:39:15 AM: 14 new files to upload
10:39:15 AM: 0 new functions to upload
10:39:15 AM: Section completed: deploying
10:39:15 AM: Site deploy was successfully initiated
10:39:15 AM: ​
10:39:15 AM: (Deploy site completed in 314ms)
10:39:15 AM: ​
10:39:15 AM: Netlify Build Complete
10:39:15 AM: ────────────────────────────────────────────────────────────────
10:39:15 AM: ​
10:39:15 AM: (Netlify Build completed in 29.5s)
10:39:15 AM: Caching artifacts
10:39:15 AM: Started saving node modules
10:39:15 AM: Finished saving node modules
10:39:15 AM: Started saving build plugins
10:39:15 AM: Finished saving build plugins
10:39:15 AM: Started saving corepack cache
10:39:15 AM: Finished saving corepack cache
10:39:15 AM: Started saving pip cache
10:39:15 AM: Finished saving pip cache
10:39:15 AM: Started saving emacs cask dependencies
10:39:15 AM: Finished saving emacs cask dependencies
10:39:15 AM: Started saving maven dependencies
10:39:15 AM: Finished saving maven dependencies
10:39:15 AM: Started saving boot dependencies
10:39:15 AM: Finished saving boot dependencies
10:39:15 AM: Started saving rust rustup cache
10:39:15 AM: Finished saving rust rustup cache
10:39:15 AM: Started saving go dependencies
10:39:15 AM: Finished saving go dependencies
10:39:15 AM: Build script success
10:39:15 AM: Section completed: building
10:39:16 AM: Site is live :sparkles:
10:39:17 AM: Uploading Cache of size 189.0MB
10:39:18 AM: Section completed: cleanup
10:39:18 AM: Finished processing build request in 47.527s

However, after merging the PR into the main branch, the subsequent build from the main branch failed. I am the only one currently working on the project, so there were no other changes to the main branch during the time I was working on the other branch.

Log for the failed build of the main branch:
10:54:21 AM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
10:54:21 AM: buildbot version: d4068f75b500fda01f8eb2592656f157c0c28aa7
10:54:21 AM: Building without cache
10:54:21 AM: Starting to prepare the repo for build
10:54:22 AM: No cached dependencies found. Cloning fresh repo
10:54:22 AM: git clone --filter=blob:none GitHub - JaneliaSciComp/ossi-website: Website showcasing projects supported through the Janelia Open Science Software Initiative (OSSI)
10:54:22 AM: Preparing Git Reference refs/heads/main
10:54:24 AM: Custom publish path detected. Proceeding with the specified path: “astro-tutorial/dist”
10:54:24 AM: Starting to install dependencies
10:54:24 AM: Python version set to 3.8
10:54:24 AM: Attempting Ruby version 2.7.2, read from environment
10:54:25 AM: Using Ruby version 2.7.2
10:54:25 AM: Started restoring cached go cache
10:54:25 AM: Finished restoring cached go cache
10:54:27 AM: go version go1.19.13 linux/amd64
10:54:27 AM: Using PHP version 8.0
10:54:28 AM: v18.19.0 is already installed.
10:54:28 AM: Now using node v18.19.0 (npm v10.2.3)
10:54:28 AM: Enabling Node.js Corepack
10:54:28 AM: Started restoring cached build plugins
10:54:28 AM: Finished restoring cached build plugins
10:54:28 AM: Started restoring cached corepack dependencies
10:54:28 AM: Finished restoring cached corepack dependencies
10:54:28 AM: No npm workspaces detected
10:54:28 AM: Started restoring cached node modules
10:54:28 AM: Finished restoring cached node modules
10:54:29 AM: Installing npm packages using npm version 10.2.3
10:54:37 AM: added 613 packages, and audited 614 packages in 8s
10:54:37 AM: 216 packages are looking for funding
10:54:37 AM: run npm fund for details
10:54:37 AM: found 0 vulnerabilities
10:54:37 AM: npm packages installed
10:54:37 AM: Successfully installed dependencies
10:54:37 AM: Starting build script
10:54:38 AM: Detected 1 framework(s)
10:54:38 AM: “astro” at version “4.2.4”
10:54:38 AM: Section completed: initializing
10:54:39 AM: ​
10:54:39 AM: Netlify Build
10:54:39 AM: ────────────────────────────────────────────────────────────────
10:54:39 AM: ​
10:54:39 AM: ❯ Version
10:54:39 AM: @netlify/build 29.32.4
10:54:39 AM: ​
10:54:39 AM: ❯ Flags
10:54:39 AM: baseRelDir: true
10:54:39 AM: buildId: 65b284281779279711bade58
10:54:39 AM: deployId: 65b284281779279711bade5a
10:54:39 AM: ​
10:54:39 AM: ❯ Current directory
10:54:39 AM: /opt/build/repo/astro-tutorial
10:54:39 AM: ​
10:54:39 AM: ❯ Config file
10:54:39 AM: No config file was defined: using default values.
10:54:39 AM: ​
10:54:39 AM: ❯ Context
10:54:39 AM: production
10:54:39 AM: ​
10:54:39 AM: Build command from Netlify app
10:54:39 AM: ────────────────────────────────────────────────────────────────
10:54:39 AM: ​
10:54:39 AM: $ npm run build
10:54:40 AM: > astro-tutorial@0.0.1 build
10:54:40 AM: > astro build
10:54:41 AM: 15:54:41 Types generated 310ms
10:54:41 AM: 15:54:41 [build] output: “static”
10:54:41 AM: 15:54:41 [build] directory: /opt/build/repo/astro-tutorial/dist/
10:54:41 AM: 15:54:41 [build] Collecting build info…
10:54:41 AM: 15:54:41 [build] ✓ Completed in 346ms.
10:54:41 AM: 15:54:41 [build] Building static entrypoints…
10:54:44 AM: 15:54:44 [astro-icon] Loaded icons from tabler
10:54:45 AM: 15:54:45 [build] ✓ Completed in 3.48s.
10:54:45 AM: building client (vite)
10:54:45 AM: 15:54:45 [vite] transforming…
10:54:47 AM: 15:54:47 [vite] ✓ 60 modules transformed.
10:54:47 AM: 15:54:47 [vite] rendering chunks…
10:54:47 AM: 15:54:47 [vite] computing gzip size…
10:54:47 AM: 15:54:47 [vite] dist/_astro/tagsStore.DabOtisG.js 0.34 kB │ gzip: 0.26 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/ToggleFilterMenuBtn.D4sZkOzJ.js 0.35 kB │ gzip: 0.26 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/ProjectCard.6TUrdkYf.js 1.09 kB │ gzip: 0.58 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/FilterMenu.QRndhvJ9.js 1.66 kB │ gzip: 0.86 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/index.b1Uj56Yn.js 1.73 kB │ gzip: 0.98 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/index.esm.7yq4e_WN.js 3.01 kB │ gzip: 1.00 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/index.UCAuQZPX.js 6.83 kB │ gzip: 2.72 kB
10:54:47 AM: 15:54:47 [vite] dist/_astro/client.2wOxL1Aq.js 135.32 kB │ gzip: 43.73 kB
10:54:47 AM: 15:54:47 [vite] ✓ built in 2.05s
10:54:47 AM: generating static routes
10:54:47 AM: 15:54:47 :arrow_forward: src/pages/index.astro
10:54:47 AM: 15:54:47 └─ /index.htmldata.forEach is not a function
10:54:47 AM: Stack trace:
10:54:47 AM: at getMostRecentContributors (file:///opt/build/repo/astro-tutorial/dist/chunks/prerender_J7A8ZLqG.mjs:735:8)
10:54:47 AM: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
10:54:47 AM: at async callComponentAsTemplateResultOrResponse (file:///opt/build/repo/astro-tutorial/node_modules/astro/dist/runtime/server/render/astro/render.js:85:25)
10:54:47 AM: at async renderPage (file:///opt/build/repo/astro-tutorial/node_modules/astro/dist/runtime/server/render/page.js:29:12)
10:54:47 AM: at async #tryRenderRoute (file:///opt/build/repo/astro-tutorial/node_modules/astro/dist/core/pipeline.js:82:18)
10:54:47 AM: ​
10:54:47 AM: “build.command” failed
10:54:47 AM: ────────────────────────────────────────────────────────────────
10:54:47 AM: ​
10:54:47 AM: Error message
10:54:47 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
10:54:47 AM: ​
10:54:47 AM: Error location
10:54:47 AM: In Build command from Netlify app:
10:54:47 AM: npm run build
10:54:47 AM: ​
10:54:47 AM: Resolved config
10:54:47 AM: build:
10:54:47 AM: base: /opt/build/repo/astro-tutorial
10:54:47 AM: command: npm run build
10:54:47 AM: commandOrigin: ui
10:54:47 AM: environment:
10:54:47 AM: - OSSI_SITE_TOKEN
10:54:47 AM: publish: /opt/build/repo/astro-tutorial/dist
10:54:47 AM: publishOrigin: ui
10:54:48 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2
10:54:48 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:54:48 AM: Failing build: Failed to build site
10:54:48 AM: Finished processing build request in 26.957s

I know the error in the main branch build is pointing to a line of code where I iterate through a data array that is being fetched from the GitHub API - here’s the relevant code in pages/index.astro:

import {getContributors} from “…/utils/githubApiHelper”
const numberOfRecentContributors = 3;
const contributors = await getContributors(numberOfRecentContributors)

And the relevant code in …/utils/githubApiHelper - the error is being thrown by the last line copied:
import {Octokit} from “@octokit/rest”
const authToken = import.meta.env.OSSI_SITE_TOKEN
const octokit = new Octokit({
baseUrl:‘https://api.github.com’,
auth: authToken,
})

export async function getContributors(numAuthors){
const {data} = await octokit.rest.repos.getContributorsStats({
owner:“allison-truhlar”,
repo:“ossi-website-framework-tests”,
})
return getMostRecentContributors(data, numAuthors)
}

export function getMostRecentContributors(data, numAuthors) {
const mostRecentContributionWeekByAuthor = new Map();
data.forEach(entry => {

What is going wrong with the data fetch in the main branch build that is not happening the deploy preview?

Looking at your deploy history, I can see only one deploy actually worked. The same PR also had this issue before the last one that worked and now the main branch continues to have this issue. Based on that, I think you got lucky in the one build that worked and the actual issue might still not be sovled.

I’d suggest wrapping your code in a try/catch and logging some data to be sure.