-
-
Notifications
You must be signed in to change notification settings - Fork 698
Updated guides intro and side menu #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request includes several updates to the documentation related to webhook handling in various frameworks such as Next.js and Remix. Key changes involve the addition of new sections and resources for Stripe and Supabase webhooks, structural adjustments for consistency, and enhancements to existing guides. Notably, the document on Stripe webhooks has been expanded to provide detailed instructions on setting up webhook handlers, while related guides have been updated to link to these new resources. Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (14)
docs/guides/frameworks/webhooks-guides-overview.mdx (3)
34-40
: Excellent addition of the Supabase database webhooks guide!The new card for the Supabase database webhooks guide is a great addition to the documentation. It provides clear information about the guide's content and is consistent with the overall structure.
For better consistency with the other cards, consider adjusting the formatting slightly:
<Card title="Supabase database webhooks guide" icon="webhook" - href="/guides/frameworks/supabase-edge-functions-database-webhooks" - > - Learn how to trigger a task from a Supabase edge function when an event occurs in your database. - </Card> + href="/guides/frameworks/supabase-edge-functions-database-webhooks"> + Learn how to trigger a task from a Supabase edge function when an event occurs in your database. + </Card>This change will make the Supabase card formatting consistent with the Stripe card above it.
40-40
: Consider keeping a channel open for user feedbackThe AI summary mentions that a note encouraging users to request guides has been removed. While the current set of guides may be comprehensive, it's often beneficial to maintain an open channel for user feedback and requests.
Consider adding a more general invitation for feedback at the end of the document, such as:
We're always looking to improve our documentation. If you have any suggestions or requests for additional guides, please let us know in our [Discord server](https://trigger.dev/discord).This keeps the door open for user input without specifically focusing on requesting new framework guides.
Line range hint
1-40
: Overall, excellent updates to the webhook guides overview!The changes in this file significantly improve the documentation by adding new guides for Stripe and Supabase webhooks. These additions align well with the PR objectives and provide users with more comprehensive coverage of webhook-related topics.
The structure remains clear and consistent, making it easy for users to navigate and find relevant information. The new cards fit seamlessly into the existing layout.
As the number of guides grows, consider organizing them into categories (e.g., "Payment Integrations", "Database Integrations") if more are added in the future. This will help maintain the document's readability and ease of navigation as it expands.
docs/guides/introduction.mdx (2)
27-35
: Excellent additions and formatting improvements!The new entries for webhook handling in Next.js, Remix, and Stripe are valuable additions to the documentation. The table formatting changes improve readability and align with common Markdown practices.
Consider standardizing the descriptions to start with "How to" for consistency:
-| [Using webhooks in Next.js](/guides/frameworks/nextjs-webhooks) | Trigger tasks from a webhook in Next.js | -| [Using webhooks in Remix](/guides/frameworks/remix-webhooks) | Trigger tasks from a webhook in Remix | -| [Stripe webhooks](/guides/examples/stripe-webhook) | Trigger tasks from incoming Stripe webhook events | +| [Using webhooks in Next.js](/guides/frameworks/nextjs-webhooks) | How to trigger tasks from a webhook in Next.js | +| [Using webhooks in Remix](/guides/frameworks/remix-webhooks) | How to trigger tasks from a webhook in Remix | +| [Stripe webhooks](/guides/examples/stripe-webhook) | How to trigger tasks from Stripe webhook events |🧰 Tools
🪛 LanguageTool
[uncategorized] ~33-~33: ‘In’ is unnecessary in most cases before the expression ‘next .’.
Context: ... | Trigger tasks from a webhook in Next.js | | [Using webhooks in Rem...(CONFUSION_OF_NN_IN_NEXT_NNP)
Line range hint
37-54
: Great updates to the Example tasks section!The changes improve the overall consistency and value of the documentation. The addition of the Supabase database operations example is a valuable inclusion, and the refinements to the descriptions enhance clarity.
For consistency, consider adjusting the description of the Supabase database operations entry to match the style of other entries:
-| [Supabase database operations](/guides/examples/supabase-database-operations) | Run basic CRUD operations on a table in a Supabase database using Trigger.dev. | +| [Supabase database operations](/guides/examples/supabase-database-operations) | How to run basic CRUD operations on a Supabase database table using Trigger.dev. |docs/guides/examples/stripe-webhook.mdx (3)
Line range hint
7-11
: Consider adding a note about securing the webhook endpointIn the Overview or Key features section, it would be beneficial to mention the importance of securing the webhook endpoint. This could include a brief note about using HTTPS and validating the Stripe signature to ensure the integrity and authenticity of incoming webhook events.
Line range hint
30-95
: Recommend including information about error handlingIn the webhook handler examples for both Next.js and Remix, consider adding more robust error handling. This could include try-catch blocks around the signature verification and task triggering processes, with appropriate error responses. This would make the examples more production-ready and help users handle potential issues.
Here's an example of how you could enhance the error handling in the Next.js example:
export async function POST(request: Request) { const signature = request.headers.get("stripe-signature"); const payload = await request.text(); if (!signature || !payload) { return NextResponse.json( { error: "Invalid Stripe payload/signature" }, { status: 400, } ); } + try { const event = Stripe.webhooks.constructEvent( payload, signature, process.env.STRIPE_WEBHOOK_SECRET as string ); // Perform the check based on the event type switch (event.type) { case "checkout.session.completed": { // Trigger the task only if the event type is "checkout.session.completed" const { id } = await tasks.trigger<typeof stripeCheckoutCompleted>( "stripe-checkout-completed", event.data.object ); return NextResponse.json({ runId: id }); } default: { // Return a response indicating that the event is not handled return NextResponse.json( { message: "Event not handled" }, { status: 200, } ); } } + } catch (err) { + console.error('Error processing webhook:', err); + return NextResponse.json( + { error: "Webhook error" }, + { + status: 400, + } + ); + } }
Line range hint
121-121
: Suggest adding a section on deploying the webhook handlerThe document provides excellent information on setting up and testing the webhook handler locally. However, it would be beneficial to include a section on deploying the webhook handler to a production environment. This could cover topics such as:
- Configuring environment variables in production
- Ensuring HTTPS is used for the webhook endpoint
- Updating the webhook URL in the Stripe dashboard
- Best practices for monitoring and logging webhook events in production
Adding this information would provide a more complete guide for users implementing Stripe webhooks with Trigger.dev.
docs/guides/frameworks/remix.mdx (4)
49-60
: LGTM: Code snippet formatting improvedThe code snippet has been reformatted for better readability, and the
loader
function implementation has been adjusted to be more concise without changing its functionality. These changes improve the overall quality of the documentation.Consider adding a comment explaining the purpose of the
loader
function for readers who might be less familiar with Remix conventions.
81-82
: Excellent addition: Note on type-only import for edge runtimeThe new note about using a type-only import for edge runtime compatibility is a valuable addition. It helps prevent potential runtime errors and provides important guidance for users deploying to Vercel Edge Functions.
Consider adding a brief explanation of why type-only imports are necessary for edge runtime compatibility. This could help users better understand the reasoning behind this requirement.
Line range hint
95-109
: LGTM: Code updated for edge runtime compatibilityThe code snippet has been successfully updated to use the edge runtime, and the
action
function has been reformatted and adjusted for better readability and conciseness. These changes are crucial for ensuring compatibility with Vercel Edge Functions.Consider adding a brief comment explaining the purpose of the
action
function and how it differs from the previousloader
function. This could help readers understand the transition from the standard Remix setup to the edge runtime setup.
200-208
: Great addition: Additional resources sectionThe new "Additional resources for Remix" section with a card linking to a guide on triggering tasks using webhooks is a valuable enhancement to the documentation. It provides users with easy access to related information and improves the overall usefulness of the guide.
Consider adding a brief introductory sentence before the card to provide context for the additional resources. For example: "To further expand your knowledge of using Trigger.dev with Remix, check out the following guide:"
docs/guides/frameworks/nextjs.mdx (1)
257-266
: Great addition of resources, consider expanding.The new "Additional resources for Next.js" section is a valuable addition to the guide. It provides users with relevant information on webhook handling, which aligns well with the overall content.
Suggestion: Consider adding more resources to this section in the future, such as links to official Next.js documentation or other related Trigger.dev guides, to make it even more comprehensive.
docs/mint.json (1)
296-297
: LGTM! Consider adding an overview page for consistency.The addition of the Stripe webhook guide to the "Webhooks" group improves the organization of the documentation. This change makes it easier for users to find webhook-related content.
For consistency with other sections, consider adding an overview page for webhooks. You could create a new page like "guides/frameworks/webhooks-overview" and add it as the first item in the "Webhooks" group.
{ "group": "Webhooks", "icon": "webhook", "iconType": "solid", "pages": [ + "guides/frameworks/webhooks-overview", "guides/frameworks/nextjs-webhooks", "guides/frameworks/remix-webhooks", "guides/examples/stripe-webhook" ] }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (6)
- docs/guides/examples/stripe-webhook.mdx (1 hunks)
- docs/guides/frameworks/nextjs.mdx (1 hunks)
- docs/guides/frameworks/remix.mdx (7 hunks)
- docs/guides/frameworks/webhooks-guides-overview.mdx (1 hunks)
- docs/guides/introduction.mdx (2 hunks)
- docs/mint.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/guides/introduction.mdx
[uncategorized] ~33-~33: ‘In’ is unnecessary in most cases before the expression ‘next .’.
Context: ... | Trigger tasks from a webhook in Next.js | | [Using webhooks in Rem...(CONFUSION_OF_NN_IN_NEXT_NNP)
🔇 Additional comments (7)
docs/guides/frameworks/webhooks-guides-overview.mdx (1)
30-33
: Great addition of the Stripe webhooks guide!The new card for Stripe webhooks is a valuable addition to the documentation. It's consistent with the existing structure and provides clear information about the guide's content.
docs/guides/introduction.mdx (1)
56-59
: Excellent addition of the community engagement note!The new note at the end of the document is a great way to encourage user feedback and participation. It helps the Trigger.dev team understand user needs and prioritize future documentation efforts.
docs/guides/examples/stripe-webhook.mdx (1)
3-3
: Approved: Improved sidebar title accuracyThe change from "Stripe webhook" to "Stripe webhooks" in the sidebarTitle is appropriate. It better reflects the content of the document, which covers handling multiple types of Stripe webhook events.
docs/guides/frameworks/remix.mdx (3)
8-13
: LGTM: Import statements reformatted for consistencyThe import statements have been updated to use double quotes, which is consistent with common JavaScript/TypeScript style guides. The slight reordering of imports improves readability without affecting functionality.
23-26
: LGTM: Steps component formatting improvedThe Steps component has been reformatted with proper indentation, which enhances readability and aligns with best practices for JSX/MDX syntax.
171-174
: Excellent addition: Reminder to deploy Trigger.dev taskThe new note reminding users to deploy their Trigger.dev task is a valuable addition to the documentation. It ensures that users complete all necessary steps for a successful integration, and the included link provides easy access to the relevant instructions.
docs/guides/frameworks/nextjs.mdx (1)
Line range hint
1-246
: LGTM: Existing content and component updates.The existing content of the guide is well-structured and informative. The updates to the
<AddEnvironmentVariables />
and<DeployingYourTask />
components are appropriate and maintain consistency with the rest of the document.Also applies to: 247-247, 249-249
Summary by CodeRabbit
New Features
Bug Fixes
Documentation