YoungVision-eV / website

https://youngvision.org
MIT License
3 stars 0 forks source link

Instagram API regulary breaks deployments #164

Open MrGreenTea opened 2 months ago

MrGreenTea commented 2 months ago

See for example this build log: https://vercel.com/youngvision/homepage-astro/kdW9ERgStxWNbVjiTjq7wVMcPskV#L177

Log output ``` Instagram API response Response { [Symbol(realm)]: null, [Symbol(state)]: { aborted: false, rangeRequested: false, timingAllowPassed: true, requestIncludesCredentials: true, type: 'default', status: 401, timingInfo: { startTime: 13210.167850999998, redirectStartTime: 0, redirectEndTime: 0, postRedirectStartTime: 13210.167850999998, finalServiceWorkerStartTime: 0, finalNetworkResponseStartTime: 0, finalNetworkRequestStartTime: 0, endTime: 0, encodedBodySize: 1, decodedBodySize: 1, finalConnectionTimingInfo: null }, cacheState: '', statusText: 'Unauthorized', headersList: HeadersList { cookies: [Array], [Symbol(headers map)]: [Map], [Symbol(headers map sorted)]: null }, urlList: [ [URL] ], body: { stream: undefined } }, [Symbol(headers)]: HeadersList { cookies: [ 'csrftoken=AUgNHvL3EEiaA18LTLqE1oHbeWx9wlR7; Domain=.instagram.com; expires=Mon, 05-May-2025 12:40:13 GMT; Max-Age=31449600; Path=/; Secure', 'mid=ZjjPrQAEAAHO952nKkw1_FKE1Hv8; Domain=.instagram.com; expires=Tue, 10-Jun-2025 12:40:13 GMT; Max-Age=34560000; Path=/; Secure', 'ig_did=BE206597-2C7D-45B0-B91E-25A7C1CD684F; Domain=.instagram.com; expires=Tue, 06-May-2025 12:40:13 GMT; HttpOnly; Max-Age=31536000; Path=/; Secure', 'ig_nrcb=1; Domain=.instagram.com; expires=Tue, 06-May-2025 12:40:13 GMT; Max-Age=31536000; Path=/; Secure' ], [Symbol(headers map)]: Map(28) { 'content-type' => [Object], 'date' => [Object], 'vary' => [Object], 'content-language' => [Object], 'strict-transport-security' => [Object], 'cache-control' => [Object], 'pragma' => [Object], 'expires' => [Object], 'x-frame-options' => [Object], 'content-security-policy' => [Object], 'cross-origin-embedder-policy-report-only' => [Object], 'report-to' => [Object], 'cross-origin-opener-policy' => [Object], 'x-content-type-options' => [Object], 'x-xss-protection' => [Object], 'x-ig-push-state' => [Object], 'x-ig-cache-control' => [Object], 'x-aed' => [Object], 'x-ig-request-elapsed-time-ms' => [Object], 'x-ig-peak-time' => [Object], 'x-stack' => [Object], 'set-cookie' => [Object], 'x-fb-load' => [Object], 'x-ig-origin-region' => [Object], 'proxy-status' => [Object], 'alt-svc' => [Object], 'connection' => [Object], 'content-length' => [Object] }, [Symbol(headers map sorted)]: null } } { message: 'Please wait a few minutes before you try again.', require_login: true, status: 'fail' } Cannot read properties of undefined (reading 'user') Stack trace: at getRecentPhotos (file:///vercel/path0/dist/chunks/prerender_BFX50VhV.mjs:12082:27) at async file:///vercel/path0/dist/chunks/prerender_BFX50VhV.mjs:12096:18 at async Object.render (file:///vercel/path0/dist/chunks/astro_CJoMymqF.mjs:1461:7)  ELIFECYCLE  Command failed with exit code 1. Error: Command "pnpm run build" exited with 1 ```

It's also an issue for us and why we can't use coolify on our hetzner server to build the website. Let's keep an eye on if this becomes an issue with cloudflare pages as well.

MrGreenTea commented 1 month ago

Perhaps we can retry the API with a delay for a few times to become more robust against this failure?

For example with exponential backoff like this https://www.npmjs.com/package/retry

MrGreenTea commented 1 week ago

https://www.studiosolid.de/blog/instagram-access-token-erzeugen-so-verbindest-du-dich-mit-der-api

MrGreenTea commented 6 days ago

Currently main can't build at all.