-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enhanced uncaught error logging, allow internal networking for AP…
…I communication (#1385) * log uncaught errors to console * add optional CODEGEN_GQL_URL var, use in gql codegen * make health endpoint check API connection * use relative GQL path in dripsQL * pass new arg through dockerfile * create valid URL for GraphQLClient * fix check
- Loading branch information
Showing
6 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,24 @@ | ||
import query from '$lib/graphql/dripsQL'; | ||
import { error } from '@sveltejs/kit'; | ||
|
||
export const GET = async () => { | ||
// simple ping endpoint for downtime-less deploys. railway will hit this and wait for 200 | ||
// before directing traffic to a newly built container | ||
// checks whether the API can be reached. This is important because private IPV6 networking | ||
// in Railway needs a few seconds to start up after a deploy | ||
|
||
const testQuery = ` | ||
query Test { | ||
__typename | ||
} | ||
`; | ||
|
||
return new Response('OK'); | ||
try { | ||
await query(testQuery); | ||
return new Response('OK'); | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error('Health endpoint error', e); | ||
return error(500); | ||
} | ||
}; |