diff --git a/src/fetch-polyfill.ts b/src/fetch-polyfill.ts new file mode 100644 index 00000000000..70a4321301b --- /dev/null +++ b/src/fetch-polyfill.ts @@ -0,0 +1,7 @@ +// fetch-polyfill.js +import fetch from 'node-fetch' + +if (!globalThis.fetch) { + // @ts-ignore + globalThis.fetch = fetch +} diff --git a/src/index.ts b/src/index.ts index b473a95e55c..926519c8e76 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import cors from 'cors' import express from 'express' import path from 'path' +import './fetch-polyfill' import { startup } from './onStartup' import { BedtimeFormat } from './servlets/bedtime/types' import { MetaTagFormat } from './servlets/metaTags/types' diff --git a/src/servlets/bedtime/index.ts b/src/servlets/bedtime/index.ts index ba6c64b4d47..d55d9150020 100644 --- a/src/servlets/bedtime/index.ts +++ b/src/servlets/bedtime/index.ts @@ -242,6 +242,7 @@ export const getBedtimeResponse = async ( } return res.send(resp) } catch (e) { + console.error(e) if (e.message === DELETED_MESSAGE) { res.status(404).send(e) } else {