From 16e7905d9139e8caa7ea332908395a9c1c99ed03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahlstr=C3=B6m=20Kalle?= Date: Thu, 18 Jan 2024 20:43:44 +0200 Subject: [PATCH 01/21] fix build --- apps/cms/src/payload.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/cms/src/payload.config.ts b/apps/cms/src/payload.config.ts index 58b65f78..2d3528a9 100644 --- a/apps/cms/src/payload.config.ts +++ b/apps/cms/src/payload.config.ts @@ -97,8 +97,8 @@ export default buildConfig({ connectOptions: { dbName: process.env.PAYLOAD_MONGO_DB_NAME, }, - // @ts-expect-error DATABASE_URL is validated by payload on start - url: process.env.PAYLOAD_MONGO_CONNECTION_STRING, + // webpack build crashes if these are not set i.e. have to default empty + url: process.env.PAYLOAD_MONGO_CONNECTION_STRING ?? "", }), editor: lexicalEditor({ features: [ From cfc41e6c4e14a169a2186dfc7138fd93195f38b6 Mon Sep 17 00:00:00 2001 From: Mikael Siidorow Date: Thu, 18 Jan 2024 21:26:50 +0200 Subject: [PATCH 02/21] add error handling for external api requests --- .../src/components/events-display/index.tsx | 7 ++++- apps/web/src/dictionaries/en.json | 3 ++ apps/web/src/dictionaries/fi.json | 3 ++ apps/web/src/lib/api/external/helpers.ts | 29 +++++++++++++++++++ apps/web/src/lib/api/external/ilmomasiina.ts | 12 ++++++-- 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 apps/web/src/lib/api/external/helpers.ts diff --git a/apps/web/src/components/events-display/index.tsx b/apps/web/src/components/events-display/index.tsx index 305c5aa3..e153a40b 100644 --- a/apps/web/src/components/events-display/index.tsx +++ b/apps/web/src/components/events-display/index.tsx @@ -76,9 +76,14 @@ async function EventList({ }) { const events = await fetchEvents(); + if (!events.ok) { + console.warn("Failed to fetch events from Ilmomasiina", events.error); + return null; + } + return (