Add Cors headers to lamda timeout so they can be detected on the FE

This commit is contained in:
Kurt Hutten
2021-06-25 19:26:33 +10:00
parent 0773915fbc
commit 87e43ab7ce
4 changed files with 33 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import {
stlToGeometry,
createHealthyResponse,
createUnhealthyResponse,
timeoutErrorMessage,
} from './common'
export const render = async ({ code }) => {
@@ -29,6 +30,9 @@ export const render = async ({ code }) => {
},
}
}
if (response.status === 502) {
return createUnhealthyResponse(new Date(), timeoutErrorMessage)
}
const data = await response.json()
const geometry = await stlToGeometry(data.url)
return createHealthyResponse({