Skip to content

Commit b63c4c1

Browse files
committed
feat(ci): add sentry monitor to update-club-info function
1 parent ea774ca commit b63c4c1

File tree

3 files changed

+204
-4
lines changed

3 files changed

+204
-4
lines changed
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
1-
import type { Config, Context } from '@netlify/functions'
1+
import type { Config, Handler } from '@netlify/functions'
22
import { getStore } from '@netlify/blobs'
3+
import { schedule } from '@netlify/functions'
4+
import { wrap } from '@netlify/integrations'
5+
6+
import { withSentry } from '@netlify/sentry'
37
import type { Clubs } from '~/types/clubs'
48
import updateClubInfo from '~/utils/update-club-info'
59

6-
export default async (context: Context) => {
10+
async function myHandler() {
711
const store = getStore('enspire')
812
const clubs: Clubs = await updateClubInfo()
913
await store.setJSON('clubs', clubs)
1014

1115
return new Response('Done')
1216
}
1317

14-
export const config: Config = {
15-
schedule: '0 */12 * * *',
18+
const withIntegrations = wrap(withSentry)
19+
20+
const config: Config = {
21+
sentry: {
22+
cronMonitoring: {
23+
enable: true,
24+
monitorId: 'update-club-info',
25+
},
26+
},
1627
}
28+
29+
const handlerWithIntegrations = withIntegrations(myHandler, config) as Handler
30+
31+
const handler = schedule('@hourly', handlerWithIntegrations)
32+
33+
export { handler }

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"@clerk/clerk-sdk-node": "^5.0.38",
2121
"@clerk/themes": "^2.1.29",
2222
"@netlify/functions": "^2.8.1",
23+
"@netlify/integrations": "^0.5.4",
24+
"@netlify/sentry": "^0.0.10",
2325
"@nuxt/content": "^2.13.2",
2426
"@radix-icons/vue": "^1.0.0",
2527
"@sentry/nuxt": "^8.30.0",

0 commit comments

Comments
 (0)