Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Glad we checked.
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshew committed Jul 4, 2022
1 parent e9f8894 commit f69a3e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: Deploy Production

# Test

on:
push:
branches:
Expand Down Expand Up @@ -32,9 +30,6 @@ jobs:
DATABASE_URL: ${{secrets.DATABASE_URL}}
run: cd packages/prisma && npx prisma migrate deploy

- name: Run unit tests
run: yarn test

- name: Make envfile
uses: SpicyPizza/[email protected]
with:
Expand Down
12 changes: 6 additions & 6 deletions apps/web/src/pages/_error.page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// @ts-nocheck
import NextErrorComponent from "next/error"
import * as Logger from "@kittr/logger/nextjs"
import { logError, flush } from "@kittr/logger/nextjs"

const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => {
if (!hasGetInitialPropsRun && err) {
// getInitialProps is not called in case of
// https://github.com/vercel/next.js/issues/8592. As a workaround, we pass
// err via _app.js so it can be captured
console.error(err)
Logger.logError(err)
logError(JSON.stringify(err))
// Flushing is not required in this case as it only happens on the client
}

Expand Down Expand Up @@ -44,20 +44,20 @@ MyError.getInitialProps = async (context) => {

if (err) {
console.error(err)
Logger.captureException(err)
logError(JSON.stringify(err))

// Flushing before returning is necessary if deploying to Vercel, see
// https://vercel.com/docs/platform/limits#streaming-responses
await Logger.flush(2000)
await flush(2000)

return errorInitialProps
}

// If this point is reached, getInitialProps was called without any
// information about what the error might be. This is unexpected and may
// indicate a bug introduced in Next.js, so record it in Logger
Logger.captureException(new Error(`_error.js getInitialProps missing data at path: ${asPath}`))
await Logger.flush(2000)
logError(new Error(`_error.js getInitialProps missing data at path: ${asPath}`))
await flush(2000)

return errorInitialProps
}
Expand Down

0 comments on commit f69a3e4

Please sign in to comment.