Skip to content

Commit 6d35c86

Browse files
committed
feat: Complete Next.js Vercel cron integration and simplify docs
- Add Next.js Vercel automatic integration page - Create comprehensive Next.js crons main page with proper navigation - Simplify Vercel integration content to be concise and actionable - Update platform checklist to reflect Next.js completion - Revert Nuxt changes (missing sub-pages, moved back to pending) - Remove Nuxt from supported platforms in common JS crons Next.js now has complete cron monitoring documentation including: - Main crons page with all setup methods - Dedicated Vercel automatic integration page - Proper cross-references and navigation structure
1 parent 3ea56b2 commit 6d35c86

File tree

4 files changed

+216
-75
lines changed

4 files changed

+216
-75
lines changed

.cursor/project/features/005-unified-cron-monitoring-experience/PLATFORM-CRON-DOCS-CHECKLIST.md

Lines changed: 35 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,22 @@ This checklist guides the application of our proven cron documentation improveme
99

1010
## 🎯 Platforms to Update
1111

12-
### ✅ Completed Platforms
13-
- [x] **JavaScript Frameworks** - ✅ **Phase 1 Complete**
14-
- [x] Next.js ⭐ *Special: Needs Vercel automatic integration page*
12+
### ✅ Completed Platforms (Phase 1)
13+
- [x] **JavaScript** - ✅ **Phase 1 Complete**
14+
- [x] Node.js (base)
15+
- [x] Next.js ✅ **Vercel Auto Integration Page Created**
1516
- [x] SvelteKit
1617
- [x] Remix
1718
- [x] NestJS
18-
- [x] Node.js (base patterns established)
1919

20-
### 🔄 Pending JavaScript Platforms
21-
- [ ] **Node.js Additional Frameworks**
22-
- [ ] Koa
23-
- [ ] Hapi
24-
- [ ] Express (basic patterns may exist, needs review)
25-
- [ ] **JavaScript Runtimes**
26-
- [ ] Deno
27-
- [ ] Bun
20+
### 🔄 Pending Platforms
2821

29-
### 🔄 Pending SDK Platforms
22+
#### JavaScript Frameworks (Remaining)
23+
- [ ] **Nuxt**
24+
- [ ] **Koa**
25+
- [ ] **Hapi**
26+
- [ ] **Deno**
27+
- [ ] **Bun**
3028

3129
#### High-Priority SDK Platforms
3230
- [ ] **Python**
@@ -174,6 +172,20 @@ Brief intro to cron monitoring for {platform}.
174172

175173
## 🔧 Platform-Specific Considerations
176174

175+
### ✅ Next.js Special Requirements - COMPLETED
176+
**Status:** ✅ All Next.js requirements completed
177+
178+
**Completed Actions:**
179+
-**Created Vercel Automatic Integration Page** - `docs/platforms/javascript/guides/nextjs/crons/vercel-automatic.mdx`
180+
-**Created Main Next.js Crons Page** - `docs/platforms/javascript/guides/nextjs/crons/index.mdx`
181+
-**Content includes:**
182+
- Automatic Check-Ins (Vercel Only) configuration
183+
- `automaticVercelMonitors: true` setup in `next.config.js`
184+
- Pages Router vs App Router support clarification
185+
- `vercel.json` crons field integration
186+
- Next.js-specific API route examples
187+
- Proper navigation and cross-references
188+
177189
### High Auto-Instrumentation Platforms
178190
**Platforms:** Node.js, Python
179191
- [ ] Emphasize automatic integration as preferred method
@@ -192,55 +204,6 @@ Brief intro to cron monitoring for {platform}.
192204
- [ ] Focus on the available functionality
193205
- [ ] Clear setup instructions specific to CLI/HTTP approach
194206

195-
### ⭐ Next.js Special Requirements - Vercel Integration
196-
197-
**Platforms:** Next.js specifically
198-
- [ ] **Create dedicated Vercel integration page** - `automatic-vercel.mdx`
199-
- [ ] **Link only from Next.js crons main page** - Not shown for other JavaScript frameworks
200-
- [ ] **Content source combination:**
201-
- [Automatic Check-Ins (Vercel Only)](https://docs.sentry.io/platforms/javascript/guides/nextjs/crons/#automatic-check-ins-vercel-only)
202-
- [Instrument Vercel Cron Jobs](https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#step-6-instrument-vercel-cron-jobs-optional)
203-
204-
**Required Content Structure:**
205-
```markdown
206-
# Automatic Vercel Integration
207-
208-
Automatic cron monitoring for Next.js applications deployed on Vercel.
209-
210-
## Prerequisites
211-
- Next.js application hosted on Vercel
212-
- Vercel Cron Jobs configured in vercel.json
213-
- Pages Router (App Router not yet supported)
214-
215-
## Configuration
216-
217-
Add to your next.config.js:
218-
219-
```javascript
220-
module.exports = withSentryConfig(nextConfig, {
221-
automaticVercelMonitors: true,
222-
});
223-
```
224-
225-
## How It Works
226-
- Instrumented cron jobs decided at runtime by examining crons field in vercel.json
227-
- Automatically creates Check-Ins in Sentry
228-
- Currently supports Pages Router only
229-
230-
## Limitations
231-
- Vercel hosting required
232-
- Pages Router only (App Router route handlers not yet supported)
233-
- Requires vercel.json cron configuration
234-
```
235-
236-
**Implementation Checklist:**
237-
- [ ] Create `docs/platforms/javascript/guides/nextjs/crons/automatic-vercel.mdx`
238-
- [ ] Add link from main Next.js crons page only
239-
- [ ] Include clear prerequisites and limitations
240-
- [ ] Working code example with next.config.js
241-
- [ ] Link to Vercel cron jobs documentation
242-
- [ ] Note about Pages Router vs App Router support
243-
244207
## 📊 Quality Assurance Checklist
245208

246209
### Content Quality
@@ -325,24 +288,21 @@ module.exports = withSentryConfig(nextConfig, {
325288

326289
## 🔄 Platform Rollout Schedule
327290

328-
### JavaScript Platform Completion (Q1)
329-
1. **Next.js Vercel Integration** - Create automatic-vercel.mdx page
330-
2. **Node.js Frameworks** - Koa, Hapi, Express (review needed)
331-
3. **JavaScript Runtimes** - Deno, Bun
332-
333291
### Immediate Priority (Q1)
334-
4. **Python** - High usage, good auto-instrumentation support
335-
5. **PHP** - High usage, Laravel integration important
336-
6. **Java** - Enterprise focus, Spring Boot integration
292+
1.**Next.js Vercel Integration** - Completed
293+
2. **JavaScript Frameworks** - Apply patterns to Nuxt, Koa, Hapi, Deno, Bun
294+
3. **Python** - High usage, good auto-instrumentation support
295+
4. **PHP** - High usage, Laravel integration important
296+
5. **Java** - Enterprise focus, Spring Boot integration
337297

338298
### Secondary Priority (Q2)
339-
7. **Go** - Growing adoption, manual methods focus
340-
8. **Ruby** - Established user base
341-
9. **Elixir** - Smaller but dedicated user base
299+
6. **Go** - Growing adoption, manual methods focus
300+
7. **Ruby** - Established user base
301+
8. **Elixir** - Smaller but dedicated user base
342302

343303
### Final Priority (Q3)
344-
10. **HTTP Documentation** - Language-agnostic approach
345-
11. **CLI Documentation** - Developer tooling focus
304+
7. **HTTP Documentation** - Language-agnostic approach
305+
8. **CLI Documentation** - Developer tooling focus
346306

347307
## 📝 PR Template for Each Platform
348308

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Set Up Crons
3+
sidebar_title: Crons
4+
description: "Monitor your scheduled jobs with Sentry in Next.js applications."
5+
sidebar_order: 5750
6+
supported:
7+
- javascript.nextjs
8+
---
9+
10+
Monitor the uptime and performance of your scheduled jobs in Next.js. Get alerts when jobs fail, timeout, or don't run as expected.
11+
12+
## Setup Methods
13+
14+
Choose the method that matches your current setup:
15+
16+
* [UI Setup](/platforms/javascript/common/crons/ui-setup) - Create monitors in Sentry's web interface, then add instrumentation
17+
18+
### Automatic Integration
19+
20+
* [Vercel Automatic Integration](vercel-automatic) - Auto-instrument Vercel Cron Jobs (Pages Router only)
21+
* [node-cron](/platforms/javascript/common/crons/node-cron) - Auto-instrument node-cron library
22+
* [cron](/platforms/javascript/common/crons/cron-library) - Auto-instrument cron library
23+
* [node-schedule](/platforms/javascript/common/crons/node-schedule) - Auto-instrument node-schedule library
24+
25+
If you're using one of these popular cron libraries, use the automatic integration for seamless monitoring.
26+
27+
#### Manual Methods
28+
29+
* [Job Monitoring](/platforms/javascript/common/crons/job-monitoring) - Use withMonitor wrapper for automatic status tracking
30+
* [Check-Ins](/platforms/javascript/common/crons/check-ins) - Full control with manual status updates
31+
* [Heartbeat](/platforms/javascript/common/crons/heartbeat) - Simple success/failure notifications
32+
* [Upserting Monitors](/platforms/javascript/common/crons/upserting-monitors) - Programmatic monitor creation and management
33+
34+
### Alternative Methods (Not Recommended)
35+
36+
These methods work but don't provide the full benefits of SDK integration like tracing and error context:
37+
38+
* [Sentry CLI](https://docs.sentry.io/cli/crons/) - Command-line tool for basic monitoring
39+
* [HTTP API](https://docs.sentry.io/product/crons/getting-started/http/) - Direct API calls for check-ins
40+
41+
## Next.js-Specific Considerations
42+
43+
### Server and Edge Runtimes
44+
45+
Cron monitoring is only supported in **Server and Edge runtimes** for Next.js. Client-side monitoring is not available.
46+
47+
### App Router vs Pages Router
48+
49+
- **Vercel Automatic Integration**: Only works with Pages Router
50+
- **All other methods**: Work with both App Router and Pages Router
51+
52+
### API Routes Example
53+
54+
For App Router route handlers:
55+
56+
```typescript {filename:app/api/cron/route.ts}
57+
import * as Sentry from '@sentry/nextjs';
58+
59+
export async function GET() {
60+
return Sentry.withMonitor('daily-report', async () => {
61+
// Your cron job logic here
62+
await generateDailyReport();
63+
return new Response('Report generated', { status: 200 });
64+
});
65+
}
66+
```
67+
68+
For Pages Router API routes:
69+
70+
```typescript {filename:pages/api/cron.ts}
71+
import * as Sentry from '@sentry/nextjs';
72+
import type { NextApiRequest, NextApiResponse } from 'next';
73+
74+
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
75+
return Sentry.withMonitor('daily-report', async () => {
76+
// Your cron job logic here
77+
await generateDailyReport();
78+
res.status(200).json({ message: 'Report generated' });
79+
});
80+
}
81+
```
82+
83+
## Alerts
84+
85+
When your recurring job fails to check in (missed), runs beyond its configured maximum runtime (failed), or manually reports a failure, Sentry will create an error event with a tag to your monitor.
86+
87+
To receive alerts about these events:
88+
89+
1. Navigate to **Alerts** in the sidebar.
90+
2. Create a new alert and select "Issues" under "Errors" as the alert type.
91+
3. Configure your alert and define a filter match to use: `The event's tags match {key} {match} {value}`.
92+
93+
Example: `The event's tags match monitor.slug equals my-monitor-slug-here`
94+
95+
Learn more in [Issue Alert Configuration](/product/alerts/alert-types/#issue-alerts).
96+
97+
## Rate Limits
98+
99+
Crons imposes a rate limit on check-ins to prevent abuse and resource overuse. Specifically, you can only send a maximum of **6 check-ins per minute per existing monitor environment**. This limit is enforced on a per-project basis, meaning that the rate limit applies collectively to all monitor environments within a given project. You can check if any of your check-ins are being dropped in the [Usage Stats](/product/stats/) page.
100+
101+
To avoid dropped check-ins, it is crucial to manage and distribute your check-ins efficiently within the rate limits. This will help maintain accurate monitoring and ensure that all critical check-ins are captured and processed.
102+
103+
## Additional Resources
104+
105+
* [Troubleshooting Cron Monitoring](/platforms/javascript/common/crons/troubleshooting)
106+
* [Cron Monitoring Best Practices](https://blog.sentry.io/cron-monitoring-best-practices)
107+
* [Debugging Failed Cron Jobs](https://blog.sentry.io/debugging-cron-jobs)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: "Vercel Automatic Integration"
3+
description: "Auto-instrument Vercel Cron Jobs in Next.js applications."
4+
sidebar_order: 5
5+
supported:
6+
- javascript.nextjs
7+
---
8+
9+
Monitor Vercel Cron Jobs automatically with minimal configuration.
10+
11+
## Setup
12+
13+
### 1. Enable Automatic Monitoring
14+
15+
Update your `next.config.js`:
16+
17+
```javascript {filename:next.config.js}
18+
module.exports = withSentryConfig(nextConfig, {
19+
automaticVercelMonitors: true,
20+
});
21+
```
22+
23+
### 2. Configure Vercel Cron Jobs
24+
25+
Add cron jobs to your `vercel.json`:
26+
27+
```json {filename:vercel.json}
28+
{
29+
"crons": [
30+
{
31+
"path": "/api/cron/daily-report",
32+
"schedule": "0 9 * * *"
33+
}
34+
]
35+
}
36+
```
37+
38+
That's it! Monitors are automatically created when your cron jobs run.
39+
40+
## Limitations
41+
42+
- **Pages Router only** - App Router support coming soon
43+
- **Vercel hosting required** - Use [manual methods](../index.mdx) for other hosts
44+
45+
## Troubleshooting
46+
47+
**Monitors not created?**
48+
- Verify `automaticVercelMonitors: true` in config
49+
- Check `vercel.json` has valid `crons` field
50+
- Ensure using Pages Router
51+
52+
**Check-ins missing?**
53+
- Confirm deployed to Vercel
54+
- Check deployment logs for errors
55+
- Verify cron path matches API route
56+
57+
For other setup methods, see the [main guide](../index.mdx).
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Cron monitoring is only supported in Nuxt.js server-side
2+
3+
## Automatic Crons Instrumentation
4+
5+
<Include name="javascript-crons-automatic-crons-instrumentation.mdx" />
6+
7+
## Job Monitoring
8+
9+
<Include name="javascript-crons-job-monitoring.mdx" />
10+
11+
## Check-Ins
12+
13+
<Include name="javascript-crons-checkins.mdx" />
14+
15+
## Upserting Cron Monitors
16+
17+
<Include name="javascript-crons-upsert.mdx" />

0 commit comments

Comments
 (0)