File tree Expand file tree Collapse file tree 3 files changed +204
-4
lines changed Expand file tree Collapse file tree 3 files changed +204
-4
lines changed Original file line number Diff line number Diff line change 1
- import type { Config , Context } from '@netlify/functions'
1
+ import type { Config , Handler } from '@netlify/functions'
2
2
import { getStore } from '@netlify/blobs'
3
+ import { schedule } from '@netlify/functions'
4
+ import { wrap } from '@netlify/integrations'
5
+
6
+ import { withSentry } from '@netlify/sentry'
3
7
import type { Clubs } from '~/types/clubs'
4
8
import updateClubInfo from '~/utils/update-club-info'
5
9
6
- export default async ( context : Context ) => {
10
+ async function myHandler ( ) {
7
11
const store = getStore ( 'enspire' )
8
12
const clubs : Clubs = await updateClubInfo ( )
9
13
await store . setJSON ( 'clubs' , clubs )
10
14
11
15
return new Response ( 'Done' )
12
16
}
13
17
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
+ } ,
16
27
}
28
+
29
+ const handlerWithIntegrations = withIntegrations ( myHandler , config ) as Handler
30
+
31
+ const handler = schedule ( '@hourly' , handlerWithIntegrations )
32
+
33
+ export { handler }
Original file line number Diff line number Diff line change 20
20
"@clerk/clerk-sdk-node" : " ^5.0.38" ,
21
21
"@clerk/themes" : " ^2.1.29" ,
22
22
"@netlify/functions" : " ^2.8.1" ,
23
+ "@netlify/integrations" : " ^0.5.4" ,
24
+ "@netlify/sentry" : " ^0.0.10" ,
23
25
"@nuxt/content" : " ^2.13.2" ,
24
26
"@radix-icons/vue" : " ^1.0.0" ,
25
27
"@sentry/nuxt" : " ^8.30.0" ,
You can’t perform that action at this time.
0 commit comments