Skip to content

Commit

Permalink
Fix fetch for collectibles embed (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson authored Nov 16, 2021
1 parent 8df556e commit c8fda37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/fetch-polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// fetch-polyfill.js
import fetch from 'node-fetch'

if (!globalThis.fetch) {
// @ts-ignore
globalThis.fetch = fetch
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions src/servlets/bedtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c8fda37

Please sign in to comment.