-
-
Notifications
You must be signed in to change notification settings - Fork 710
Supabase database webhook example upgrade #1386
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
|
Warning Rate limit exceeded@D-K-P has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 24 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThis pull request involves several changes to documentation files related to the Trigger.dev framework. The guides for triggering tasks from Supabase database webhooks and basic edge functions have been updated for clarity and structure. Titles and descriptions have been modified, new sections added, and prerequisites expanded. Additionally, the configuration file has been adjusted to manage redirects and navigation effectively, reflecting the removal of certain guides. Changes
Possibly related PRs
Suggested reviewers
Poem
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: 3
🧹 Outside diff range and nitpick comments (18)
docs/snippets/supabase-prerequisites.mdx (2)
20-20
: Approve change with minor grammatical correction.The simplified instruction focusing only on
package.json
is good. However, there's a minor grammatical issue that should be addressed.Consider this minor grammatical correction:
- If your project does not already have `package.json` file (e.g. if you are using Deno), create it manually in your project's root folder. + If your project does not already have a `package.json` file (e.g., if you are using Deno), create it manually in your project's root folder.🧰 Tools
🪛 LanguageTool
[uncategorized] ~20-~20: You might be missing the article “a” here.
Context: ... If your project does not already havepackage.json
file (e.g. if you are usin...(AI_EN_LECTOR_MISSING_DETERMINER_A)
22-22
: Approve change with minor punctuation correction.The updated info box correctly focuses on the
package.json
file, maintaining consistency with the rest of the document.Consider this minor punctuation correction:
- <Info> If your project has a `package.json` file you can skip this step.</Info> + <Info> If your project has a `package.json` file, you can skip this step.</Info>🧰 Tools
🪛 LanguageTool
[uncategorized] ~22-~22: A comma might be missing here.
Context: ...o> If your project has apackage.json
file you can skip this step. This is...(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
docs/guides/introduction.mdx (4)
7-11
: LGTM: New imports for framework cards.The added imports for card components align with the new "Frameworks" section. They follow a consistent naming convention, which is good for maintainability.
Consider grouping these imports together in a single line for better readability:
import { CardBun, CardNodejs, CardNextjs, CardRemix, CardSupabase } from "/snippets/cards";This assumes that all card components are exported from a single file. If not, the current approach is fine.
13-21
: LGTM: New "Frameworks" section enhances document structure.The addition of the "Frameworks" section with a CardGroup component provides a clear, visual overview of supported frameworks. This structure is user-friendly and aligns well with the document's new scope.
Consider adding a brief introductory text before the CardGroup to provide context for the frameworks listed. For example:
## Frameworks Trigger.dev supports integration with various frameworks. Choose your preferred framework to get started: <CardGroup cols={3}> ... </CardGroup>
23-30
: LGTM: New "Guides" section provides valuable resources.The addition of the "Guides" section with a concise introduction and a well-structured table of available guides enhances the document's utility. The included guides cover important topics for getting started with Trigger.dev.
Consider adding a third column to the table for the difficulty level or estimated time to complete each guide. This could help users choose the most appropriate guide for their skill level or time constraints. For example:
| Guide | Description | Difficulty/Time | | :---- | :---------- | :-------------- | | [Prisma](/guides/frameworks/prisma) | This guide will show you how to setup Prisma with Trigger.dev | Beginner / 15 min | | [Sequin database triggers](/guides/frameworks/sequin) | This guide will show you how to trigger tasks from database changes using Sequin | Intermediate / 30 min |
Line range hint
32-52
: LGTM: Comprehensive "Examples" section adds significant value.The new "Examples" section provides a wealth of practical tasks that users can leverage. The table format is consistent with the "Guides" section, maintaining a cohesive document structure. The wide range of examples showcases the versatility of Trigger.dev.
To improve scannability, consider grouping the examples by category or technology. You could add a "Category" column to the table or use subheadings to separate different types of examples. For instance:
## Examples Tasks you can copy and paste to get started with Trigger.dev. They can all be extended and customized to fit your needs. ### AI and Machine Learning | Example task | Description | | :----------- | :---------- | | [DALL·E 3 image generation](/guides/examples/dall-e3-generate-image) | Use OpenAI's GPT-4o and DALL·E 3 to generate an image and text. | | [Deepgram audio transcription](/guides/examples/deepgram-transcribe-audio) | Transcribe audio using Deepgram's speech recognition API. | | [Vercel AI SDK](/guides/examples/vercel-ai-sdk) | Use Vercel AI SDK to generate text using OpenAI. | ### Media Processing | Example task | Description | | :----------- | :---------- | | [FFmpeg video processing](/guides/examples/ffmpeg-video-processing) | Use FFmpeg to process a video in various ways and save it to Cloudflare R2. | | [PDF to image](/guides/examples/pdf-to-image) | Use `MuPDF` to turn a PDF into images and save them to Cloudflare R2. | | [Sharp image processing](/guides/examples/sharp-image-processing) | Use Sharp to process an image and save it to Cloudflare R2. | ... (continue for other categories)This organization can help users quickly find examples relevant to their specific needs.
docs/guides/frameworks/sequin.mdx (6)
Line range hint
1-29
: LGTM! Minor suggestion for clarity.The updated title and description accurately represent the content of the guide. The prerequisites are comprehensive and provide necessary context for users.
Consider changing "You are about to create a regular Trigger.dev task that you will execute when ever a post is inserted or updated in your database" to "You are about to create a regular Trigger.dev task that will execute whenever a post is inserted or updated in your database" for improved clarity and correct spelling.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~27-~27: The official spelling of this programming framework is “Next.js”.
Context: ...w Trigger.dev's Next.js setup guide to setup your project. You can return ...(NODE_JS)
[grammar] ~27-~27: The word “setup” is a noun. The verb is spelled with a white space.
Context: ... guide](/guides/frameworks/nextjs) to setup your project. You can return to this gu...(NOUN_VERB_CONFUSION)
Line range hint
47-120
: Suggestions for improved error handling and code organization.The code snippets effectively implement the described functionality. However, consider the following improvements:
Error handling in the
createEmbeddingForPost
task:
- Add a try-catch block to handle potential errors from the OpenAI API call and the
upsertEmbedding
function.Environment variable validation:
- Add checks for required environment variables (OPENAI_API_KEY, DATABASE_URL) at the beginning of the task.
Code organization in
utils.ts
:
- Consider moving the database connection logic to a separate function or module for better reusability.
Here's an example of how you could improve the
createEmbeddingForPost
task:import { task } from "@trigger.dev/sdk/v3"; import { OpenAI } from "openai"; import { upsertEmbedding } from "../util"; const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY, }); export const createEmbeddingForPost = task({ id: "create-embedding-for-post", run: async (payload: { record: { id: number; title: string; body: string; author: string; createdAt: string; embedding: string | null; }, metadata: { table_schema: string, table_name: string, consumer: { id: string; name: string; }; }; }) => { if (!process.env.OPENAI_API_KEY || !process.env.DATABASE_URL) { throw new Error("Missing required environment variables"); } try { const content = `${payload.record.title}\n\n${payload.record.body}`; const embeddingResponse = await openai.embeddings.create({ model: "text-embedding-ada-002", input: content, }); const embedding = embeddingResponse.data[0].embedding; await upsertEmbedding(embedding, payload.record.id); return { ...payload.record, embedding: JSON.stringify(embedding), }; } catch (error) { console.error("Error in createEmbeddingForPost task:", error); throw error; } } });Would you like me to provide suggestions for improving the
utils.ts
file as well?🧰 Tools
🪛 LanguageTool
[uncategorized] ~87-~87: Loose punctuation mark.
Context: ...N.stringify(embedding), }; } }); ```` ```ts utils.ts import pg from ...(UNLIKELY_OPENING_PUNCTUATION)
Line range hint
211-271
: LGTM! Minor formatting suggestions and security note.The instructions for creating a Sequin consumer are clear and comprehensive. Here are some minor suggestions to improve the section:
Formatting: Consider using a consistent numbering system throughout the steps. Currently, some steps use numbers (1, 2, 3) while others use dots (1., 2., 3.).
Security note: Add a reminder about the importance of keeping the
SEQUIN_WEBHOOK_SECRET
secure.Consider adding the following security note at the end of the section:
<Note> Remember to keep your `SEQUIN_WEBHOOK_SECRET` secure and never expose it in client-side code or public repositories. Regularly rotate this secret to maintain the security of your webhook endpoint. </Note>This addition will help reinforce good security practices for users implementing this integration.
Line range hint
273-320
: LGTM! Consider adding a troubleshooting tip.The end-to-end test instructions are clear and comprehensive, covering all aspects of the setup from creating a test post to verifying the process in both Sequin and Trigger.dev dashboards.
Consider adding a troubleshooting tip at the end of this section to help users who might encounter issues:
<Tip> If you don't see the expected results, check the following: 1. Ensure all services (Next.js app, Trigger.dev dev server, and Sequin tunnel) are running. 2. Verify that your database connection and Sequin configuration are correct. 3. Check the logs of your Next.js app and Trigger.dev dev server for any error messages. 4. Confirm that the `SEQUIN_WEBHOOK_SECRET` in your `.env.local` file matches the one set in the Sequin console. </Tip>This addition will provide users with a starting point for troubleshooting common issues they might encounter during the testing process.
Line range hint
322-331
: Expand the "Next steps" section for more comprehensive guidance.The current "Next steps" section provides good initial suggestions for error handling and production deployment. However, consider expanding this section to provide more specific guidance and cover additional important aspects of production readiness.
Here's an expanded version of the "Next steps" section:
## Next steps With Sequin and Trigger.dev, every post in your database will now have an embedding. This is a simple example of how you can trigger long-running tasks on database changes. To make your implementation production-ready, consider the following steps: 1. **Error Handling and Monitoring**: - Add [retries](/errors-retrying) to your Trigger.dev task to ensure that any errors are captured and logged. - Implement comprehensive error logging and monitoring to track task execution and catch any issues early. 2. **Performance Optimization**: - Consider batching database operations if you expect high volumes of changes. - Optimize your OpenAI API usage to minimize costs and improve response times. 3. **Security Enhancements**: - Implement rate limiting on your API endpoint to prevent abuse. - Regularly rotate your `SEQUIN_WEBHOOK_SECRET` and other sensitive credentials. 4. **Scalability**: - Design your system to handle increased load as your database grows. - Consider implementing a queue system for handling spikes in database changes. 5. **Testing**: - Develop a comprehensive test suite, including unit tests for your tasks and integration tests for the entire flow. 6. **Documentation**: - Create detailed documentation for your team, covering the setup process, maintenance procedures, and troubleshooting guides. 7. **Production Deployment**: - Deploy to [production](/guides/frameworks/nextjs#deploying-your-task-to-trigger-dev) and update your Sequin consumer to point to your production database and endpoint. - Set up a staging environment to test changes before deploying to production. 8. **Monitoring and Alerting**: - Implement monitoring for your Trigger.dev tasks and Sequin consumers. - Set up alerts for any failures or anomalies in the embedding creation process. By addressing these points, you'll create a robust, scalable, and maintainable system for creating embeddings from your database content.This expanded section provides a more comprehensive roadmap for users to follow when preparing their implementation for production use.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~330-~330: The official spelling of this programming framework is “Next.js”.
Context: ...ured and logged. - Deploy to production and...(NODE_JS)
Line range hint
1-331
: Address minor spelling and grammar issues.Based on the static analysis hints, there are a few minor issues that should be addressed:
Line ~27: Change "setup" to "set up" when used as a verb.
- guide](/guides/frameworks/nextjs) to setup your project. You can return + guide](/guides/frameworks/nextjs) to set up your project. You can returnLine ~87: Remove the extra backtick at the end of the code block.
- }); ```` + }); ```Throughout the document: Ensure consistent spelling of "Next.js" (with a lowercase "j").
Please make these minor corrections to improve the overall quality of the documentation.
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (6)
Line range hint
2-25
: Improved title, description, and overviewThe updates to the title, description, and overview significantly enhance the clarity and specificity of the guide. The new overview provides a more detailed explanation of the workflow, which will help readers better understand the process before diving into the implementation.
Consider adding a brief sentence at the end of the overview to highlight the benefits of this integration, such as "This integration allows for automated processing and analysis of video content, enhancing the capabilities of your Supabase-powered application."
🧰 Tools
🪛 LanguageTool
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~260-~260: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~294-~294: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~391-~391: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~395-~395: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
27-69
: Updated prerequisites and streamlined setupThe additions to the prerequisites, including Docker Desktop and a Deepgram account, are crucial for users to successfully follow this guide. The removal of irrelevant CLI steps helps streamline the setup process.
Consider adding a note about the approximate time required to complete this guide, which can help users plan accordingly. For example: "Note: This guide may take approximately 30-45 minutes to complete, depending on your familiarity with the tools and concepts."
89-282
: Comprehensive guide for creating and deploying the Trigger.dev taskThe new section on creating and deploying the Trigger.dev task is thorough and well-explained. The step-by-step instructions, including type definition generation, task creation, and deployment, provide users with a clear path to follow.
In the
videoProcessAndUpdate
task code snippet, consider adding a comment to explain the purpose of thesmart_format
anddiarize
options in the Deepgram transcription configuration. This will help users understand the significance of these settings.const { result, error } = await deepgram.listen.prerecorded.transcribeFile( fs.readFileSync(outputPath), { model: "nova-2", // Use the Nova 2 model smart_format: true, // Automatically format the transcription diarize: true, // Enable speaker diarization + // smart_format: Improves readability by adding punctuation and capitalization + // diarize: Separates the transcription by speaker, useful for multi-speaker audio } );🧰 Tools
🪛 LanguageTool
[style] ~260-~260: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
284-346
: Clear instructions for Supabase Edge Function setup and deploymentThe new section on creating and deploying the Supabase Edge Function is well-structured and informative. The step-by-step instructions, including adding the Trigger.dev secret key and creating the Edge Function, provide users with a clear path to follow.
In the Edge Function code snippet, consider adding a simple error handling mechanism to log any issues that might occur during the task triggering process. This can help with debugging if something goes wrong. For example:
// Trigger the videoProcessAndUpdate task with the videoUrl payload -await tasks.trigger<typeof videoProcessAndUpdate>("video-process-and-update", { videoUrl, id }); +try { + await tasks.trigger<typeof videoProcessAndUpdate>("video-process-and-update", { videoUrl, id }); + console.log("Task triggered successfully"); +} catch (error) { + console.error("Error triggering task:", error); +} console.log(payload ?? "No name provided");🧰 Tools
🪛 LanguageTool
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~294-~294: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
387-405
: Clear instructions for testing the workflowThe new section on triggering the entire workflow provides excellent guidance for users to test and verify their setup. The step-by-step instructions for inserting a new row and checking the results are clear and concise.
Consider adding a note about the expected time frame for the workflow to complete. This can help users understand when to check for results and prevent unnecessary concern if the process takes longer than expected. For example:
"Note: Depending on the length of the video and system load, the transcription process may take a few minutes to complete. If you don't see immediate results, wait for a short period and refresh the Supabase table."
🧰 Tools
🪛 LanguageTool
[style] ~391-~391: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~395-~395: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
Line range hint
1-405
: Excellent improvements to the Supabase Database Webhook guideThe updates to this guide have significantly enhanced its usability, clarity, and completeness. The additions provide a comprehensive walkthrough of the integration between Supabase and Trigger.dev for video transcription, covering all necessary steps from setup to testing.
To further improve the guide, consider adding a section on error handling and troubleshooting. This could include common issues users might encounter during setup or execution of the workflow, along with their solutions. This addition would make the guide even more robust and user-friendly, especially for those new to these technologies.
🧰 Tools
🪛 LanguageTool
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~260-~260: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~294-~294: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~391-~391: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~395-~395: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (6)
docs/images/supabase-create-webhook-2.png
is excluded by!**/*.png
docs/images/supabase-create-webhook-3.png
is excluded by!**/*.png
docs/images/supabase-new-table-2.png
is excluded by!**/*.png
docs/images/supabase-new-table-3.png
is excluded by!**/*.png
docs/images/supabase-new-table-4.png
is excluded by!**/*.png
docs/images/supabase-trigger-screenshot.png
is excluded by!**/*.png
📒 Files selected for processing (7)
- docs/guides/frameworks/introduction.mdx (0 hunks)
- docs/guides/frameworks/prisma.mdx (1 hunks)
- docs/guides/frameworks/sequin.mdx (8 hunks)
- docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (2 hunks)
- docs/guides/introduction.mdx (1 hunks)
- docs/mint.json (2 hunks)
- docs/snippets/supabase-prerequisites.mdx (1 hunks)
💤 Files with no reviewable changes (1)
- docs/guides/frameworks/introduction.mdx
🧰 Additional context used
🪛 LanguageTool
docs/guides/frameworks/sequin.mdx
[uncategorized] ~27-~27: The official spelling of this programming framework is “Next.js”.
Context: ...w Trigger.dev's Next.js setup guide to setup your project. You can return ...(NODE_JS)
[grammar] ~27-~27: The word “setup” is a noun. The verb is spelled with a white space.
Context: ... guide](/guides/frameworks/nextjs) to setup your project. You can return to this gu...(NOUN_VERB_CONFUSION)
[uncategorized] ~87-~87: Loose punctuation mark.
Context: ...N.stringify(embedding), }; } }); ```` ```ts utils.ts import pg from ...(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~330-~330: The official spelling of this programming framework is “Next.js”.
Context: ...ured and logged. - Deploy to production and...(NODE_JS)
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~260-~260: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~292-~292: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~294-~294: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~391-~391: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~391-~391: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~395-~395: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~401-~401: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
docs/snippets/supabase-prerequisites.mdx
[uncategorized] ~20-~20: You might be missing the article “a” here.
Context: ... If your project does not already havepackage.json
file (e.g. if you are usin...(AI_EN_LECTOR_MISSING_DETERMINER_A)
[uncategorized] ~22-~22: A comma might be missing here.
Context: ...o> If your project has apackage.json
file you can skip this step. This is...(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
🔇 Additional comments (9)
docs/snippets/supabase-prerequisites.mdx (2)
18-18
: LGTM: Title change accurately reflects the simplified step.The updated title focuses solely on creating a
package.json
file, which aligns well with the subsequent content changes.
34-34
: LGTM: Valuable reminder about TypeScript version.The added note is a good reminder for users to keep their TypeScript version up to date. This can help prevent potential compatibility issues and ensure users have access to the latest features and improvements.
docs/guides/introduction.mdx (2)
2-4
: LGTM: Frontmatter updates improve clarity and accuracy.The updated title and description better reflect the expanded scope of the document, providing a clear overview of its contents.
Line range hint
1-52
: Overall, excellent improvements to the introduction document.The restructuring and content additions in this file significantly enhance its value to users. The new sections on Frameworks, Guides, and Examples provide a comprehensive overview of Trigger.dev's capabilities and resources. The changes align well with the PR objectives and improve the document's utility as an entry point for users.
A few minor suggestions have been provided to further enhance readability and user experience. Great work on this update!
docs/guides/frameworks/prisma.mdx (1)
1-3
: Improved title clarity and consistencyThe changes to both the main title and sidebar title from "Prisma" to "Prisma setup guide" are beneficial:
- The new title is more descriptive and accurately reflects the document's content.
- It helps users quickly understand that this is a setup guide, not just general information about Prisma.
- The consistency between the main title and sidebar title is maintained, which is good for navigation.
These updates improve the overall clarity and user experience of the documentation.
docs/mint.json (2)
261-264
: Confirm the intention of the empty group name.The addition of the "guides/introduction" page to the navigation is good. However, the group name is currently empty. Is this intentional, or should it have a name like "Guides" or "Introduction"?
Please clarify the intention behind the empty group name. If it's not intentional, consider adding an appropriate name to improve the navigation structure.
261-264
: Verify the removal of redundant navigation entries.The AI summary indicates that
guides/frameworks/introduction
andguides/examples/intro
have been removed from their respective navigation groups. This aligns with the new redirects and helps streamline the documentation structure.To ensure consistency, please verify that these pages have been removed from the navigation:
#!/bin/bash # Check for any remaining references to the removed pages in the navigation grep -n -e "guides/frameworks/introduction" -e "guides/examples/intro" docs/mint.jsonIf any references are found, consider removing them to maintain consistency with the new structure.
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (2)
75-87
: Clear instructions for creating the Supabase tableThe new section on creating the
video_transcriptions
table in Supabase is well-structured and easy to follow. The step-by-step instructions, combined with the screenshots, provide excellent guidance for users of all experience levels.🧰 Tools
🪛 LanguageTool
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
348-385
: Comprehensive guide for creating the Database WebhookThe new section on creating the Database Webhook in Supabase is excellent. The step-by-step instructions, combined with the screenshots, provide clear and detailed guidance for users to set up the webhook correctly.
The inclusion of information about the JWT requirement for Supabase Edge Functions is particularly helpful for users to understand the security aspects of the setup.
🧰 Tools
🪛 LanguageTool
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~350-~350: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~354-~354: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
<Step title="Optional step 2: create a package.json file"> | ||
|
||
If your project does not already have `package.json` or/and `tsconfig.json` files (e.g. if you are using Deno), create them manually and add them to your project root folder. | ||
If your project does not already have `package.json` file (e.g. if you are using Deno), create it manually in your project's root folder. | ||
|
||
<Info> If your project has these files you can skip this step.</Info> | ||
<Info> If your project has a `package.json` file you can skip this step.</Info> | ||
|
||
Both of these files are required for the Trigger.dev SDK to work correctly. | ||
This is required for the Trigger.dev SDK to work correctly. | ||
|
||
```ts package.json | ||
{ | ||
"devDependencies": { | ||
// This should be the version of typescript you are using | ||
"typescript": "^5.6.2" | ||
} | ||
} | ||
``` | ||
|
||
```ts tsconfig.json | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"outDir": "dist", | ||
"skipLibCheck": true, | ||
"lib": ["DOM", "DOM.Iterable"], | ||
"noEmit": true | ||
}, | ||
"include": ["./src/**/*.ts", "trigger.config.ts"] | ||
} | ||
``` | ||
<Note> Update your Typescript version to the latest version available. </Note> |
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.
💡 Codebase verification
Additional tsconfig.json
references found in documentation.
The removal of tsconfig.json
mentions in docs/snippets/supabase-prerequisites.mdx
simplifies that section. However, tsconfig.json
is still referenced in the following documentation files:
docs/guides/new-build-system-preview.mdx
docs/config/config-file.mdx
docs/config/extensions/overview.mdx
Please ensure that tsconfig.json
references are consistently handled across all documentation to maintain clarity for users relying on TypeScript configuration.
🔗 Analysis chain
Overall changes improve documentation clarity, with a note on TypeScript configuration.
The modifications successfully simplify the setup process by focusing on the package.json
file. This change improves clarity and reduces potential confusion for users.
However, it's worth noting that the removal of tsconfig.json
references might impact users who need TypeScript configuration. To ensure we're not overlooking any critical information, let's verify if there are any other mentions of tsconfig.json
in the documentation:
If the search returns results, consider adding a note about TypeScript configuration or linking to relevant TypeScript setup documentation.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for mentions of tsconfig.json in the documentation
# Test: Look for tsconfig.json mentions
rg --type mdx 'tsconfig\.json'
Length of output: 60
Script:
#!/bin/bash
# Description: Search for mentions of tsconfig.json in .mdx documentation files
# Test: Look for tsconfig.json mentions in .mdx files
rg 'tsconfig\.json' --glob '*.mdx'
Length of output: 394
🧰 Tools
🪛 LanguageTool
[uncategorized] ~20-~20: You might be missing the article “a” here.
Context: ... If your project does not already havepackage.json
file (e.g. if you are usin...(AI_EN_LECTOR_MISSING_DETERMINER_A)
[uncategorized] ~22-~22: A comma might be missing here.
Context: ...o> If your project has apackage.json
file you can skip this step. This is...(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
docs/mint.json
Outdated
{ | ||
"source": "/guides/frameworks/introduction", | ||
"destination": "/guides/overview" | ||
}, | ||
{ | ||
"source": "/guides/examples/intro", | ||
"destination": "/guides/overview" | ||
}, |
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.
💡 Codebase verification
Issue Found: Destination Page /guides/overview
Does Not Exist
The redirect to /guides/overview
cannot be validated because the destination page does not exist directly at that path. Instead, an supabase-guides-overview.mdx
file exists under docs/guides/frameworks/
.
Please update the redirect to point to the correct path:
/guides/frameworks/supabase-guides-overview
Ensure that the destination path accurately reflects the location of the overview page to maintain proper navigation and avoid broken links.
#!/bin/bash
# Search for any routing configurations that might map /guides/overview
rg "/guides/overview" config/
🔗 Analysis chain
LGTM! Verify the destination page exists.
The new redirects consolidate introductory pages into a single overview, which aligns with the PR objectives. This change should improve navigation and reduce redundancy in the documentation.
To ensure a smooth user experience, please verify that the /guides/overview
page exists and contains the necessary introductory information from the redirected pages.
Further Verification Needed: Destination Page /guides/overview
Not Found
The previous verification did not confirm the existence of /guides/overview
. Please ensure that the destination page exists with an appropriate extension.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify the existence of the destination page
fd -t f "overview.mdx?" docs/guides
Length of output: 182
Script:
#!/bin/bash
# Search for the overview page with common markdown extensions
fd -t f "overview.mdx" docs/guides || fd -t f "overview.md" docs/guides
Length of output: 86
```ts app/api/create-embedding-for-post/route.ts | ||
import type { createEmbeddingForPost } from "@/trigger/create-embedding-for-post"; | ||
import { tasks } from "@trigger.dev/sdk/v3"; | ||
import { NextResponse } from "next/server"; | ||
|
||
return NextResponse.json(handle); | ||
export async function POST(req: Request) { | ||
const authHeader = req.headers.get("authorization"); | ||
if (!authHeader || authHeader !== `Bearer ${process.env.SEQUIN_WEBHOOK_SECRET}`) { | ||
return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); | ||
} | ||
``` | ||
const payload = await req.json(); | ||
const handle = await tasks.trigger<typeof createEmbeddingForPost>( | ||
"create-embedding-for-post", | ||
payload | ||
); | ||
|
||
return NextResponse.json(handle); | ||
} | ||
``` | ||
|
||
This route handler will receive records from Sequin, parse them, and then trigger the `create-embedding-for-post` task. | ||
|
||
This route handler will receive records from Sequin, parse them, and then trigger the `create-embedding-for-post` task. | ||
</Step> | ||
<Step title="Set secret keys"> | ||
You'll need to set four secret keys in a `.env.local` file: | ||
|
||
```bash | ||
SEQUIN_WEBHOOK_SECRET=your-secret-key | ||
TRIGGER_SECRET_KEY=secret-from-trigger-dev | ||
OPENAI_API_KEY=sk-proj-asdfasdfasdf | ||
DATABASE_URL=postgresql:// | ||
``` | ||
```bash | ||
SEQUIN_WEBHOOK_SECRET=your-secret-key | ||
TRIGGER_SECRET_KEY=secret-from-trigger-dev | ||
OPENAI_API_KEY=sk-proj-asdfasdfasdf | ||
DATABASE_URL=postgresql:// | ||
``` |
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.
🛠️ Refactor suggestion
Enhance security and error handling in the route handler.
The API route setup is clear and well-explained. However, consider the following improvements to enhance security and error handling:
- Use a constant-time comparison for the authorization header to prevent timing attacks.
- Add input validation for the payload.
- Implement proper error handling for the
tasks.trigger
call.
Here's an improved version of the route handler:
import type { createEmbeddingForPost } from "@/trigger/create-embedding-for-post";
import { tasks } from "@trigger.dev/sdk/v3";
import { NextResponse } from "next/server";
import { timingSafeEqual } from "crypto";
export async function POST(req: Request) {
try {
const authHeader = req.headers.get("authorization");
if (!authHeader || !isValidAuthHeader(authHeader)) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
const payload = await req.json();
if (!isValidPayload(payload)) {
return NextResponse.json({ error: "Invalid payload" }, { status: 400 });
}
const handle = await tasks.trigger<typeof createEmbeddingForPost>(
"create-embedding-for-post",
payload
);
return NextResponse.json(handle);
} catch (error) {
console.error("Error in POST handler:", error);
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
}
}
function isValidAuthHeader(header: string): boolean {
const expectedHeader = `Bearer ${process.env.SEQUIN_WEBHOOK_SECRET}`;
return timingSafeEqual(Buffer.from(header), Buffer.from(expectedHeader));
}
function isValidPayload(payload: any): boolean {
// Implement payload validation logic here
return true; // Placeholder
}
This version includes constant-time comparison for the authorization header, a placeholder for payload validation, and proper error handling. Remember to implement the isValidPayload
function according to your specific payload structure.
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 (5)
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (5)
18-25
: Great improvement in the overview section.The restructured overview provides a much clearer explanation of the workflow, detailing the interaction between Supabase, Edge Functions, and Trigger.dev. This will help readers better understand the guide's objectives and the process they'll be following.
Consider adding a brief sentence at the end of this section to highlight the practical application or benefit of this workflow, e.g., "This workflow enables automatic transcription of videos, making content more accessible and searchable."
🧰 Tools
🪛 LanguageTool
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
30-69
: Comprehensive prerequisites and setup instructions.The addition of Docker Desktop and Deepgram account requirements, along with the updated CLI command for initial setup, provides users with a more complete list of prerequisites and clearer setup instructions.
Consider adding a brief note about the purpose of the Deepgram API key, e.g., "The Deepgram API key will be used for audio transcription later in the guide."
89-287
: Comprehensive task creation and deployment instructions.The detailed instructions for creating and deploying the Trigger.dev task, including code snippets and environment variable setup, provide excellent guidance for users. This section covers all the necessary steps for setting up this crucial part of the workflow.
Consider adding a brief explanation of the purpose of the FFmpeg build extension in the
trigger.config.ts
file, e.g., "The FFmpeg build extension is required for audio extraction from the video files."🧰 Tools
🪛 LanguageTool
[style] ~265-~265: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
353-390
: Excellent Database Webhook creation instructions.The detailed, step-by-step instructions for creating a Database Webhook in Supabase, accompanied by images, provide clear and comprehensive guidance for users. This section effectively covers a crucial part of the workflow setup.
Consider adding a brief explanation of why the
anon
public
API key is used for the webhook authorization, e.g., "We use theanon
public
API key here as this webhook doesn't require authenticated access to your database."🧰 Tools
🪛 LanguageTool
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
Line range hint
1-414
: Excellent comprehensive guide with clear instructions.This guide provides a well-structured, detailed, and easy-to-follow set of instructions for implementing a Supabase-Trigger.dev workflow. The step-by-step approach, accompanied by code snippets and images, effectively guides users through the entire process.
To further enhance the guide, consider adding a troubleshooting section at the end. This could include common issues users might encounter and their solutions, helping to preemptively address potential stumbling blocks.
🧰 Tools
🪛 LanguageTool
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~265-~265: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~299-~299: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~396-~396: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~400-~400: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (4)
docs/images/supabase-new-table-4.png
is excluded by!**/*.png
docs/images/supabase-run-result.png
is excluded by!**/*.png
docs/images/supabase-table-result.png
is excluded by!**/*.png
docs/images/supabase-trigger-screenshot.png
is excluded by!**/*.png
📒 Files selected for processing (2)
- docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (2 hunks)
- docs/mint.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/mint.json
🧰 Additional context used
🪛 LanguageTool
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx
[typographical] ~20-~20: Consider adding two commas here.
Context: ...ebhook triggers an Edge Function when a row including a video URL is inserted into a table - The Edge Fun...(UNLIKE_COMMA)
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~265-~265: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...s to your Trigger.dev project You will need to add yourDEEPGRAM_SECRET_KEY
, `SUPABA...(REP_NEED_TO_VB)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~299-~299: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...ect dashboard, click 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...} color="A8FF53" />, then the 'API' tab <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~355-~355: Possible typo: you repeated a word
Context: ...anon
public
API key from the table <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...se-api-key.png) Then, go to 'Database' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ...} color="A8FF53" /> click on 'Webhooks' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~359-~359: Possible typo: you repeated a word
Context: ... />, and then click 'Create a new hook' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[style] ~396-~396: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~400-~400: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
🔇 Additional comments (4)
docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx (4)
2-4
: LGTM! Title and description improvements.The updated title with proper capitalization and the expanded description provide a clearer overview of the guide's content. These changes effectively communicate the purpose and scope of the tutorial.
75-87
: Excellent addition of table creation instructions.The new section on creating the
video_transcriptions
table in Supabase is a valuable addition to the guide. The step-by-step instructions, accompanied by images, provide clear and easy-to-follow guidance for users.🧰 Tools
🪛 LanguageTool
[style] ~79-~79: Consider a more expressive alternative.
Context: ...re the video URL and transcription. To do this, click on 'Table Editor' <Icon ico...(DO_ACHIEVE)
[duplication] ~79-~79: Possible typo: you repeated a word
Context: ...n. To do this, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...calledvideo_url
with the typetext
<Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~85-~85: Possible typo: you repeated a word
Context: ...anscription, also with the type
text` <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
289-351
: Clear instructions for Edge Function creation and deployment.The step-by-step guide for creating and deploying the Supabase Edge Function, including the code snippet, provides excellent guidance for users. This section effectively covers an essential part of the workflow, ensuring that the Trigger.dev task can be triggered appropriately.
🧰 Tools
🪛 LanguageTool
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ... to use, navigate to 'Project settings' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...lor="A8FF53" />, click 'Edge Functions' <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~297-~297: Possible typo: you repeated a word
Context: ...nu, and then click the 'Add new secret' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~299-~299: Possible typo: you repeated a word
Context: ...3" /> button. AddTRIGGER_SECRET_KEY
<Icon icon="circle-4" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
392-414
: Effective workflow triggering instructions.The step-by-step guidance for triggering the entire workflow, including inserting a new row and checking the results, provides an excellent practical demonstration of the setup. This section effectively helps users verify that their implementation is working correctly.
🧰 Tools
🪛 LanguageTool
[style] ~396-~396: Consider a more expressive alternative.
Context: ... yourvideo_transcriptions
table. To do this, go back to your Supabase project ...(DO_ACHIEVE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ject dashboard, click on 'Table Editor' <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ...ick on thevideo_transcriptions
table <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~396-~396: Possible typo: you repeated a word
Context: ..., and then click 'Insert', 'Insert Row' <Icon icon="circle-3" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~400-~400: Possible typo: you repeated a word
Context: ...rvideo_url
, with a public video url. <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: .../cloud.trigger.dev) project 'Runs' list <Icon icon="circle-1" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
[duplication] ~406-~406: Possible typo: you repeated a word
Context: ...processingvideoProcessAndUpdate
task <Icon icon="circle-2" iconType="solid" size={20} c...(ENGLISH_WORD_REPEAT_RULE)
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 (5)
docs/snippets/supabase-docs-cards.mdx (1)
14-15
: Improved consistency and clarity, with a minor suggestion.The changes to the second Card component enhance the overall presentation:
- The title now clearly indicates that this is a guide, setting appropriate expectations.
- The icon change from "bolt" to "book" better represents the nature of the content.
- These updates improve consistency with the first card and accurately reflect the content type.
However, the removal of "Edge function" from the title might slightly reduce clarity about the specific technology used. Consider the following minor adjustment:
- title="Database webhooks guide" + title="Edge function database webhooks guide"This adjustment would maintain consistency with the first card's title format while preserving important context about the technology involved.
docs/guides/frameworks/supabase-edge-functions-basic.mdx (4)
29-29
: Approved: Important prerequisite addedThe addition of the Docker Desktop requirement is crucial information for users. This ensures they have all necessary tools before starting the deployment process.
Consider adding a brief explanation of why Docker Desktop is required, to help users understand its importance in the deployment process.
Line range hint
73-101
: Approved: Improved code snippet with better guidanceThe updated code snippet provides clearer instructions and better type support. The added comments guide users on how to correctly import and use the SDK and task types, which is particularly helpful for newcomers.
Consider adding a brief comment explaining the purpose of the
Deno.serve
function for users who might be unfamiliar with Deno's API.
Line range hint
116-120
: Approved: Clarification on JWT verification optionThe added note about the
--no-verify-jwt
option provides important context for users. It clarifies that while this option is used for the example, it may not be suitable for production use.Consider adding a brief statement about when users should use JWT verification in production environments to enhance security awareness.
Line range hint
150-191
: Approved: Improved deployment and triggering instructionsThe updated section provides clearer instructions for deploying and triggering tasks from the edge function. The added note about replacing the project ID helps prevent potential errors, and the congratulatory message at the end adds a positive touch to the user experience.
Consider adding a troubleshooting section or link to common issues that users might encounter during this process, to further improve the guide's helpfulness.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- docs/guides/frameworks/supabase-edge-functions-basic.mdx (1 hunks)
- docs/mint.json (9 hunks)
- docs/snippets/supabase-docs-cards.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- docs/mint.json
🧰 Additional context used
🔇 Additional comments (2)
docs/snippets/supabase-docs-cards.mdx (1)
7-8
: Improved clarity and consistency in card presentation.The changes to the first Card component enhance the user experience:
- The title now clearly indicates that this is a guide, which sets the right expectations for the content.
- The icon change from "bolt" to "book" better represents the nature of the content (a guide).
- These updates improve consistency with the second card and accurately reflect the content type.
These modifications will help users better understand the purpose of the linked content at a glance.
docs/guides/frameworks/supabase-edge-functions-basic.mdx (1)
Line range hint
134-146
: Excellent improvement: Clear instructions with visual aidsThe expanded section with step-by-step instructions and visual aids significantly enhances the user experience. The use of numbered icons makes it easier for users to follow the process of setting up the Trigger.dev secret key in the Supabase dashboard.
commit 886429b Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:36:46 2024 +0100 Removed emails, @trigger.dev/database and @trigger.dev/otlp-importer from changesets config commit f65157a Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:31:27 2024 +0100 Lockfile with run-engine removed commit 3d67bb8 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:24:31 2024 +0100 Removed run-engine from the webapp package.json/tsconfig commit d30e971 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:06:04 2024 +0100 Dockerfile fix because the database package has been moved commit f2babbf Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 09:41:22 2024 -0700 Internal packages (testcontainers, redis-worker and zod-worker) (#1392) * Some notes on the new run engine * lockfile with setup for the run engine * Documenting where TaskRun is currently mutated, to try figure out the shape of the new system * Added notes about how triggering currently works * Details about when triggering happens * Lots of notes about waitpoints * Started scaffolding the RunEngine * Sketch of Prisma waitpoint schema while it’s fresh in my mind * Got Prisma working with testcontainers * Use beforeEach/afterEach * Simple Prisma and Redis test * Return Redis options instead of a client * Simplified things * A very simple FIFO pull-based queue to check the tests working properly * Use vitest extend * Separate redis, postgres and combined tests for faster testing * Some fixes and test improvements * Pass a logger into the queue * A queue processor that processes items from the given queue as fast as it can * Test for retrying an item that wasn’t processed * First draft of waitpoints in the Prisma schema * Remove the custom logger from the test * Added a completedAt to Waitpoint * Notes on the flow for an execution starting * Added redlock, moved some files around * Starting point for the TaskRunExecutionSnapshot table * Added relationships to TaskRunExecutionSnapshot * Change some tsconfig * Moved some things around * Added some packages * WIP on the RunQueue * Fix for some imports * Key producer with some tests * Removed the nv type from the keys… it’s not useful to do global queries * Passing unit tests for all the public key producer functions * Some basic tests passing for the RunQueue * Simple enqueue test working * Enqueue and dequeue for dev is working * Don’t log everything during the tests * Enqueuing/dequeuing from the shared queue is working * Tests for getting a shared queue * The key producer sharedQueue can now be named, to allow multiple separate queues * The key producer uses the name of the queue as the input * Extra info in the Prisma schema * Dequeuing a message gets the payload and sets the task concurrency all in one Lua script * Adding more keys so we can read the concurrency from the queue * Setting the concurrency with dequeue and enquque is working * Improved the tests and fixed some bugs * Acking is resetting the concurrencies * Check the key has been removed after acking * Nacking is working * Changed the package to CommonJS + Node10 so it works with Redlock * Moved the database, otel and emails packages to be in internal-packages * Moved some Prisma code to the database package * Started using the RunEngine for triggering * Progress on run engine triggering, first waitpoint code * Create a delay waitpoint * Moved ZodWorker to an internal package so it can be used in the run engine as well as the webapp * Web app now uses the zod worker package * Added parseNaturalLanguageDuration to core/apps * internal-packages/zod-worker in the lockfile * Pass in the master queue, remove old rebalance workers code * Add masterQueue to TaskRun * Fixed the tests * Moved waitpoint code into the run engine, also the zod worker * Completing waitpoints * An experiment to create a new test container with environment * More changes to triggering * Started testing triggering * Test for a run getting triggered and being enqueued * Removed dequeueMessageInEnv * Update dev queue tests to use the shared queue function * Schema changes for TaskRunExecutionSnapshot * First execution snapshot when the run is created. Dequeue run function added to the engine * Separate internal package for testcontainers so they can be used elsewhere * Remove the simple queue and testcontainers from the run-engine. They’re going to be separate * Fix for the wrong path to the Prisma schem,a * Added the testcontainers package to the run-engine * redis-worker package, just a copy of the simple queue for now * The queue now uses Lua to enqueue dequeue * The queue now has a catalog and an invisible period after dequeuing * Added a visibility timeout and acking, with tests * Added more Redis connection logging, deleted todos * Visibility timeouts are now defined on the catalog and can be overridden when enqueuing * Dequeue multiple items at once * Test for dequeuing multiple items * Export some types to be used elsewhere * Partial refactor of the processor * First stab at a worker with concurrency and NodeWorkers * Don’t have a default visibility timeout in the queue * Worker setup and processing items in a simple test * Process jobs in parallel with retrying * Get the attempt when dequeuing * Workers do exponential backoff * Moved todos * DLQ functionality * DLQ tests * Same cluster for all keys in the same queue * Added DLQ tests * Whitespace * Redis pubsub to redrive from the worker * Fixed database paths * Fix for path to zod-worker * Fixes for typecheck errors, mostly with TS versions and module resolution * Redlock required a patch * Moved the new DB migrations to the new database package folder * Remove the run-engine package * Remove the RunEngine prisma schema changes * Delete triggerTaskV2 * Remove zodworker test script (no tests) * Update test-containers readme * Generate the client first * Use a specific version of the prisma package * Generate the prisma client before running the unit tests commit fc60947 Author: Dan <8297864+D-K-P@users.noreply.github.com> Date: Tue Oct 8 14:36:03 2024 +0100 Supabase database webhook example upgrade (#1386) * Added overview for guides and examples section and split them all out * New supabase guide wip * Updated images and improved docs * Trimmed the supabase prereqs * Supabase guide wip * more updates * Replaced old database webhook guide * Created one intro page and removed snippets * Updated guide sidebar titles * Code updates * More improvements * Updates and added images * Compressed image * Updated guides descriptions and edge function basic * Removed bold * Updated redirects * Fixed broken links * Updated intro commit 07f82ea Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 13:28:54 2024 +0100 Release 3.0.11 commit 13ebfcc Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Oct 8 13:24:38 2024 +0100 chore: Update version for release (#1381) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 2a04d17 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:24:23 2024 +0100 Simplify showLogs expression commit 002ae4b Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:29 2024 +0100 Fix dotenv overrides for dev runs (#1388) * override dashboard dev env vars with local .env * add changeset * add simple task for testing env vars commit 047cb00 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:05 2024 +0100 Disable schedules for deleted orgs on next tick (#1383) * disable schedules for deleted orgs * add debug logs commit 2c014f7 Author: James Ritchie <james@trigger.dev> Date: Sun Oct 6 13:02:00 2024 -0700 Override log retention (#1385) * set full log retention as admin * If run.logsDeletedAt is set, don’t bother getting the trace commit a69e04f Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 14:18:58 2024 +0100 Include push output in logs for self-hosted deploys (#1382) * include push output in logs * changeset commit c5488df Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 13:12:47 2024 +0100 Fix CLI downgrade check (#1380) * fix downgrade detection * remove unused semver package from webapp * add changeset commit 1caec27 Author: Eric Allam <eric@trigger.dev> Date: Fri Oct 4 15:33:35 2024 -0700 docs: Max duration (#1379) * maxDuration docs * Update the init command to set the maxDuration and include a commented out maxDuration in the config file commit e14c954 Author: Eric Allam <eallam@icloud.com> Date: Fri Oct 4 15:02:05 2024 -0700 Release 3.0.10 commit 8e61f5d Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Oct 4 14:59:07 2024 -0700 chore: Update version for release (#1378) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 08db565 Author: Eric Allam <eallam@icloud.com> Date: Thu Oct 3 12:38:25 2024 -0700 improve the timed out description commit 6d08842 Author: Eric Allam <eric@trigger.dev> Date: Thu Oct 3 12:43:26 2024 -0700 feat: Add maxDuration to tasks (#1377) * WIP * Get max duration working on deployed runs * Actually set the timed out runs to status = TIMED_OUT * The client status for TIMED_OUT is now MAX_DURATION_EXCEEDED * New TimedOutIcon * Added new timedout icon * Add ability to opt-out of maxDuration with timeout.None * MAX_DURATION_EXCEEDED -> TIMED_OUT * changeset * Improved styling for the status tooltip content --------- Co-authored-by: James Ritchie <james@trigger.dev> commit 665ccf8 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu Oct 3 12:33:18 2024 +0100 Update github actions and self-hosting docs commit 1ff7b86 Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 18:26:36 2024 -0700 Add max queue depth limits (#1376) * Add runs to an env queue, as well as the actual queue * Add queue size limit guard on triggering tasks commit c531a9d Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 15:30:39 2024 -0700 fix: cleanup ttl expire run graphile jobs (#1373) * fix: remove ttl expire run graphile jobs when a run is started or completed * Update expireEnqueuedRun.server.ts commit 0bf500f Author: Matt Aitken <matt@mattaitken.com> Date: Wed Oct 2 15:30:16 2024 -0700 Prioritize finishing waited runs (#1375) * If a tree node is missing, estimate the size as zero * Task to test prioritizing finishing existing runs after triggerAndWaits * When requeuing a run with a checkpoint, put it in the queue with the parent run time so it’s correctly prioritized * The same change but if there’s no checkpoint
commit 886429b Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:36:46 2024 +0100 Removed emails, @trigger.dev/database and @trigger.dev/otlp-importer from changesets config commit f65157a Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:31:27 2024 +0100 Lockfile with run-engine removed commit 3d67bb8 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:24:31 2024 +0100 Removed run-engine from the webapp package.json/tsconfig commit d30e971 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:06:04 2024 +0100 Dockerfile fix because the database package has been moved commit f2babbf Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 09:41:22 2024 -0700 Internal packages (testcontainers, redis-worker and zod-worker) (#1392) * Some notes on the new run engine * lockfile with setup for the run engine * Documenting where TaskRun is currently mutated, to try figure out the shape of the new system * Added notes about how triggering currently works * Details about when triggering happens * Lots of notes about waitpoints * Started scaffolding the RunEngine * Sketch of Prisma waitpoint schema while it’s fresh in my mind * Got Prisma working with testcontainers * Use beforeEach/afterEach * Simple Prisma and Redis test * Return Redis options instead of a client * Simplified things * A very simple FIFO pull-based queue to check the tests working properly * Use vitest extend * Separate redis, postgres and combined tests for faster testing * Some fixes and test improvements * Pass a logger into the queue * A queue processor that processes items from the given queue as fast as it can * Test for retrying an item that wasn’t processed * First draft of waitpoints in the Prisma schema * Remove the custom logger from the test * Added a completedAt to Waitpoint * Notes on the flow for an execution starting * Added redlock, moved some files around * Starting point for the TaskRunExecutionSnapshot table * Added relationships to TaskRunExecutionSnapshot * Change some tsconfig * Moved some things around * Added some packages * WIP on the RunQueue * Fix for some imports * Key producer with some tests * Removed the nv type from the keys… it’s not useful to do global queries * Passing unit tests for all the public key producer functions * Some basic tests passing for the RunQueue * Simple enqueue test working * Enqueue and dequeue for dev is working * Don’t log everything during the tests * Enqueuing/dequeuing from the shared queue is working * Tests for getting a shared queue * The key producer sharedQueue can now be named, to allow multiple separate queues * The key producer uses the name of the queue as the input * Extra info in the Prisma schema * Dequeuing a message gets the payload and sets the task concurrency all in one Lua script * Adding more keys so we can read the concurrency from the queue * Setting the concurrency with dequeue and enquque is working * Improved the tests and fixed some bugs * Acking is resetting the concurrencies * Check the key has been removed after acking * Nacking is working * Changed the package to CommonJS + Node10 so it works with Redlock * Moved the database, otel and emails packages to be in internal-packages * Moved some Prisma code to the database package * Started using the RunEngine for triggering * Progress on run engine triggering, first waitpoint code * Create a delay waitpoint * Moved ZodWorker to an internal package so it can be used in the run engine as well as the webapp * Web app now uses the zod worker package * Added parseNaturalLanguageDuration to core/apps * internal-packages/zod-worker in the lockfile * Pass in the master queue, remove old rebalance workers code * Add masterQueue to TaskRun * Fixed the tests * Moved waitpoint code into the run engine, also the zod worker * Completing waitpoints * An experiment to create a new test container with environment * More changes to triggering * Started testing triggering * Test for a run getting triggered and being enqueued * Removed dequeueMessageInEnv * Update dev queue tests to use the shared queue function * Schema changes for TaskRunExecutionSnapshot * First execution snapshot when the run is created. Dequeue run function added to the engine * Separate internal package for testcontainers so they can be used elsewhere * Remove the simple queue and testcontainers from the run-engine. They’re going to be separate * Fix for the wrong path to the Prisma schem,a * Added the testcontainers package to the run-engine * redis-worker package, just a copy of the simple queue for now * The queue now uses Lua to enqueue dequeue * The queue now has a catalog and an invisible period after dequeuing * Added a visibility timeout and acking, with tests * Added more Redis connection logging, deleted todos * Visibility timeouts are now defined on the catalog and can be overridden when enqueuing * Dequeue multiple items at once * Test for dequeuing multiple items * Export some types to be used elsewhere * Partial refactor of the processor * First stab at a worker with concurrency and NodeWorkers * Don’t have a default visibility timeout in the queue * Worker setup and processing items in a simple test * Process jobs in parallel with retrying * Get the attempt when dequeuing * Workers do exponential backoff * Moved todos * DLQ functionality * DLQ tests * Same cluster for all keys in the same queue * Added DLQ tests * Whitespace * Redis pubsub to redrive from the worker * Fixed database paths * Fix for path to zod-worker * Fixes for typecheck errors, mostly with TS versions and module resolution * Redlock required a patch * Moved the new DB migrations to the new database package folder * Remove the run-engine package * Remove the RunEngine prisma schema changes * Delete triggerTaskV2 * Remove zodworker test script (no tests) * Update test-containers readme * Generate the client first * Use a specific version of the prisma package * Generate the prisma client before running the unit tests commit fc60947 Author: Dan <8297864+D-K-P@users.noreply.github.com> Date: Tue Oct 8 14:36:03 2024 +0100 Supabase database webhook example upgrade (#1386) * Added overview for guides and examples section and split them all out * New supabase guide wip * Updated images and improved docs * Trimmed the supabase prereqs * Supabase guide wip * more updates * Replaced old database webhook guide * Created one intro page and removed snippets * Updated guide sidebar titles * Code updates * More improvements * Updates and added images * Compressed image * Updated guides descriptions and edge function basic * Removed bold * Updated redirects * Fixed broken links * Updated intro commit 07f82ea Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 13:28:54 2024 +0100 Release 3.0.11 commit 13ebfcc Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Oct 8 13:24:38 2024 +0100 chore: Update version for release (#1381) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 2a04d17 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:24:23 2024 +0100 Simplify showLogs expression commit 002ae4b Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:29 2024 +0100 Fix dotenv overrides for dev runs (#1388) * override dashboard dev env vars with local .env * add changeset * add simple task for testing env vars commit 047cb00 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:05 2024 +0100 Disable schedules for deleted orgs on next tick (#1383) * disable schedules for deleted orgs * add debug logs commit 2c014f7 Author: James Ritchie <james@trigger.dev> Date: Sun Oct 6 13:02:00 2024 -0700 Override log retention (#1385) * set full log retention as admin * If run.logsDeletedAt is set, don’t bother getting the trace commit a69e04f Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 14:18:58 2024 +0100 Include push output in logs for self-hosted deploys (#1382) * include push output in logs * changeset commit c5488df Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 13:12:47 2024 +0100 Fix CLI downgrade check (#1380) * fix downgrade detection * remove unused semver package from webapp * add changeset commit 1caec27 Author: Eric Allam <eric@trigger.dev> Date: Fri Oct 4 15:33:35 2024 -0700 docs: Max duration (#1379) * maxDuration docs * Update the init command to set the maxDuration and include a commented out maxDuration in the config file commit e14c954 Author: Eric Allam <eallam@icloud.com> Date: Fri Oct 4 15:02:05 2024 -0700 Release 3.0.10 commit 8e61f5d Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Oct 4 14:59:07 2024 -0700 chore: Update version for release (#1378) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 08db565 Author: Eric Allam <eallam@icloud.com> Date: Thu Oct 3 12:38:25 2024 -0700 improve the timed out description commit 6d08842 Author: Eric Allam <eric@trigger.dev> Date: Thu Oct 3 12:43:26 2024 -0700 feat: Add maxDuration to tasks (#1377) * WIP * Get max duration working on deployed runs * Actually set the timed out runs to status = TIMED_OUT * The client status for TIMED_OUT is now MAX_DURATION_EXCEEDED * New TimedOutIcon * Added new timedout icon * Add ability to opt-out of maxDuration with timeout.None * MAX_DURATION_EXCEEDED -> TIMED_OUT * changeset * Improved styling for the status tooltip content --------- Co-authored-by: James Ritchie <james@trigger.dev> commit 665ccf8 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu Oct 3 12:33:18 2024 +0100 Update github actions and self-hosting docs commit 1ff7b86 Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 18:26:36 2024 -0700 Add max queue depth limits (#1376) * Add runs to an env queue, as well as the actual queue * Add queue size limit guard on triggering tasks commit c531a9d Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 15:30:39 2024 -0700 fix: cleanup ttl expire run graphile jobs (#1373) * fix: remove ttl expire run graphile jobs when a run is started or completed * Update expireEnqueuedRun.server.ts commit 0bf500f Author: Matt Aitken <matt@mattaitken.com> Date: Wed Oct 2 15:30:16 2024 -0700 Prioritize finishing waited runs (#1375) * If a tree node is missing, estimate the size as zero * Task to test prioritizing finishing existing runs after triggerAndWaits * When requeuing a run with a checkpoint, put it in the queue with the parent run time so it’s correctly prioritized * The same change but if there’s no checkpoint
* Checkbox component can have its label styles * Improved the dialog footer * Handle sending feedback to Slack using Plain * WIP making the modal conditional * Moved the Plain form action into the select plan file * removed comment * Show a confirmation diaglog if you’re downgrading from Pro to Hobby * Downgrading to Hobby works * Use redirectWithErrorMessage instead of throw error * The cancel form now submits the data correctly * Modals don’t trigger when you upgrade * Copy improvements * Added a tooltip to explain the link to the pricing page * Squashed commit of the following: commit 886429b Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:36:46 2024 +0100 Removed emails, @trigger.dev/database and @trigger.dev/otlp-importer from changesets config commit f65157a Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:31:27 2024 +0100 Lockfile with run-engine removed commit 3d67bb8 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:24:31 2024 +0100 Removed run-engine from the webapp package.json/tsconfig commit d30e971 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:06:04 2024 +0100 Dockerfile fix because the database package has been moved commit f2babbf Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 09:41:22 2024 -0700 Internal packages (testcontainers, redis-worker and zod-worker) (#1392) * Some notes on the new run engine * lockfile with setup for the run engine * Documenting where TaskRun is currently mutated, to try figure out the shape of the new system * Added notes about how triggering currently works * Details about when triggering happens * Lots of notes about waitpoints * Started scaffolding the RunEngine * Sketch of Prisma waitpoint schema while it’s fresh in my mind * Got Prisma working with testcontainers * Use beforeEach/afterEach * Simple Prisma and Redis test * Return Redis options instead of a client * Simplified things * A very simple FIFO pull-based queue to check the tests working properly * Use vitest extend * Separate redis, postgres and combined tests for faster testing * Some fixes and test improvements * Pass a logger into the queue * A queue processor that processes items from the given queue as fast as it can * Test for retrying an item that wasn’t processed * First draft of waitpoints in the Prisma schema * Remove the custom logger from the test * Added a completedAt to Waitpoint * Notes on the flow for an execution starting * Added redlock, moved some files around * Starting point for the TaskRunExecutionSnapshot table * Added relationships to TaskRunExecutionSnapshot * Change some tsconfig * Moved some things around * Added some packages * WIP on the RunQueue * Fix for some imports * Key producer with some tests * Removed the nv type from the keys… it’s not useful to do global queries * Passing unit tests for all the public key producer functions * Some basic tests passing for the RunQueue * Simple enqueue test working * Enqueue and dequeue for dev is working * Don’t log everything during the tests * Enqueuing/dequeuing from the shared queue is working * Tests for getting a shared queue * The key producer sharedQueue can now be named, to allow multiple separate queues * The key producer uses the name of the queue as the input * Extra info in the Prisma schema * Dequeuing a message gets the payload and sets the task concurrency all in one Lua script * Adding more keys so we can read the concurrency from the queue * Setting the concurrency with dequeue and enquque is working * Improved the tests and fixed some bugs * Acking is resetting the concurrencies * Check the key has been removed after acking * Nacking is working * Changed the package to CommonJS + Node10 so it works with Redlock * Moved the database, otel and emails packages to be in internal-packages * Moved some Prisma code to the database package * Started using the RunEngine for triggering * Progress on run engine triggering, first waitpoint code * Create a delay waitpoint * Moved ZodWorker to an internal package so it can be used in the run engine as well as the webapp * Web app now uses the zod worker package * Added parseNaturalLanguageDuration to core/apps * internal-packages/zod-worker in the lockfile * Pass in the master queue, remove old rebalance workers code * Add masterQueue to TaskRun * Fixed the tests * Moved waitpoint code into the run engine, also the zod worker * Completing waitpoints * An experiment to create a new test container with environment * More changes to triggering * Started testing triggering * Test for a run getting triggered and being enqueued * Removed dequeueMessageInEnv * Update dev queue tests to use the shared queue function * Schema changes for TaskRunExecutionSnapshot * First execution snapshot when the run is created. Dequeue run function added to the engine * Separate internal package for testcontainers so they can be used elsewhere * Remove the simple queue and testcontainers from the run-engine. They’re going to be separate * Fix for the wrong path to the Prisma schem,a * Added the testcontainers package to the run-engine * redis-worker package, just a copy of the simple queue for now * The queue now uses Lua to enqueue dequeue * The queue now has a catalog and an invisible period after dequeuing * Added a visibility timeout and acking, with tests * Added more Redis connection logging, deleted todos * Visibility timeouts are now defined on the catalog and can be overridden when enqueuing * Dequeue multiple items at once * Test for dequeuing multiple items * Export some types to be used elsewhere * Partial refactor of the processor * First stab at a worker with concurrency and NodeWorkers * Don’t have a default visibility timeout in the queue * Worker setup and processing items in a simple test * Process jobs in parallel with retrying * Get the attempt when dequeuing * Workers do exponential backoff * Moved todos * DLQ functionality * DLQ tests * Same cluster for all keys in the same queue * Added DLQ tests * Whitespace * Redis pubsub to redrive from the worker * Fixed database paths * Fix for path to zod-worker * Fixes for typecheck errors, mostly with TS versions and module resolution * Redlock required a patch * Moved the new DB migrations to the new database package folder * Remove the run-engine package * Remove the RunEngine prisma schema changes * Delete triggerTaskV2 * Remove zodworker test script (no tests) * Update test-containers readme * Generate the client first * Use a specific version of the prisma package * Generate the prisma client before running the unit tests commit fc60947 Author: Dan <8297864+D-K-P@users.noreply.github.com> Date: Tue Oct 8 14:36:03 2024 +0100 Supabase database webhook example upgrade (#1386) * Added overview for guides and examples section and split them all out * New supabase guide wip * Updated images and improved docs * Trimmed the supabase prereqs * Supabase guide wip * more updates * Replaced old database webhook guide * Created one intro page and removed snippets * Updated guide sidebar titles * Code updates * More improvements * Updates and added images * Compressed image * Updated guides descriptions and edge function basic * Removed bold * Updated redirects * Fixed broken links * Updated intro commit 07f82ea Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 13:28:54 2024 +0100 Release 3.0.11 commit 13ebfcc Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Oct 8 13:24:38 2024 +0100 chore: Update version for release (#1381) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 2a04d17 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:24:23 2024 +0100 Simplify showLogs expression commit 002ae4b Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:29 2024 +0100 Fix dotenv overrides for dev runs (#1388) * override dashboard dev env vars with local .env * add changeset * add simple task for testing env vars commit 047cb00 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:05 2024 +0100 Disable schedules for deleted orgs on next tick (#1383) * disable schedules for deleted orgs * add debug logs commit 2c014f7 Author: James Ritchie <james@trigger.dev> Date: Sun Oct 6 13:02:00 2024 -0700 Override log retention (#1385) * set full log retention as admin * If run.logsDeletedAt is set, don’t bother getting the trace commit a69e04f Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 14:18:58 2024 +0100 Include push output in logs for self-hosted deploys (#1382) * include push output in logs * changeset commit c5488df Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 13:12:47 2024 +0100 Fix CLI downgrade check (#1380) * fix downgrade detection * remove unused semver package from webapp * add changeset commit 1caec27 Author: Eric Allam <eric@trigger.dev> Date: Fri Oct 4 15:33:35 2024 -0700 docs: Max duration (#1379) * maxDuration docs * Update the init command to set the maxDuration and include a commented out maxDuration in the config file commit e14c954 Author: Eric Allam <eallam@icloud.com> Date: Fri Oct 4 15:02:05 2024 -0700 Release 3.0.10 commit 8e61f5d Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Oct 4 14:59:07 2024 -0700 chore: Update version for release (#1378) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 08db565 Author: Eric Allam <eallam@icloud.com> Date: Thu Oct 3 12:38:25 2024 -0700 improve the timed out description commit 6d08842 Author: Eric Allam <eric@trigger.dev> Date: Thu Oct 3 12:43:26 2024 -0700 feat: Add maxDuration to tasks (#1377) * WIP * Get max duration working on deployed runs * Actually set the timed out runs to status = TIMED_OUT * The client status for TIMED_OUT is now MAX_DURATION_EXCEEDED * New TimedOutIcon * Added new timedout icon * Add ability to opt-out of maxDuration with timeout.None * MAX_DURATION_EXCEEDED -> TIMED_OUT * changeset * Improved styling for the status tooltip content --------- Co-authored-by: James Ritchie <james@trigger.dev> commit 665ccf8 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu Oct 3 12:33:18 2024 +0100 Update github actions and self-hosting docs commit 1ff7b86 Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 18:26:36 2024 -0700 Add max queue depth limits (#1376) * Add runs to an env queue, as well as the actual queue * Add queue size limit guard on triggering tasks commit c531a9d Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 15:30:39 2024 -0700 fix: cleanup ttl expire run graphile jobs (#1373) * fix: remove ttl expire run graphile jobs when a run is started or completed * Update expireEnqueuedRun.server.ts commit 0bf500f Author: Matt Aitken <matt@mattaitken.com> Date: Wed Oct 2 15:30:16 2024 -0700 Prioritize finishing waited runs (#1375) * If a tree node is missing, estimate the size as zero * Task to test prioritizing finishing existing runs after triggerAndWaits * When requeuing a run with a checkpoint, put it in the queue with the parent run time so it’s correctly prioritized * The same change but if there’s no checkpoint * Squashed commit of the following: commit 886429b Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:36:46 2024 +0100 Removed emails, @trigger.dev/database and @trigger.dev/otlp-importer from changesets config commit f65157a Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:31:27 2024 +0100 Lockfile with run-engine removed commit 3d67bb8 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:24:31 2024 +0100 Removed run-engine from the webapp package.json/tsconfig commit d30e971 Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 18:06:04 2024 +0100 Dockerfile fix because the database package has been moved commit f2babbf Author: Matt Aitken <matt@mattaitken.com> Date: Tue Oct 8 09:41:22 2024 -0700 Internal packages (testcontainers, redis-worker and zod-worker) (#1392) * Some notes on the new run engine * lockfile with setup for the run engine * Documenting where TaskRun is currently mutated, to try figure out the shape of the new system * Added notes about how triggering currently works * Details about when triggering happens * Lots of notes about waitpoints * Started scaffolding the RunEngine * Sketch of Prisma waitpoint schema while it’s fresh in my mind * Got Prisma working with testcontainers * Use beforeEach/afterEach * Simple Prisma and Redis test * Return Redis options instead of a client * Simplified things * A very simple FIFO pull-based queue to check the tests working properly * Use vitest extend * Separate redis, postgres and combined tests for faster testing * Some fixes and test improvements * Pass a logger into the queue * A queue processor that processes items from the given queue as fast as it can * Test for retrying an item that wasn’t processed * First draft of waitpoints in the Prisma schema * Remove the custom logger from the test * Added a completedAt to Waitpoint * Notes on the flow for an execution starting * Added redlock, moved some files around * Starting point for the TaskRunExecutionSnapshot table * Added relationships to TaskRunExecutionSnapshot * Change some tsconfig * Moved some things around * Added some packages * WIP on the RunQueue * Fix for some imports * Key producer with some tests * Removed the nv type from the keys… it’s not useful to do global queries * Passing unit tests for all the public key producer functions * Some basic tests passing for the RunQueue * Simple enqueue test working * Enqueue and dequeue for dev is working * Don’t log everything during the tests * Enqueuing/dequeuing from the shared queue is working * Tests for getting a shared queue * The key producer sharedQueue can now be named, to allow multiple separate queues * The key producer uses the name of the queue as the input * Extra info in the Prisma schema * Dequeuing a message gets the payload and sets the task concurrency all in one Lua script * Adding more keys so we can read the concurrency from the queue * Setting the concurrency with dequeue and enquque is working * Improved the tests and fixed some bugs * Acking is resetting the concurrencies * Check the key has been removed after acking * Nacking is working * Changed the package to CommonJS + Node10 so it works with Redlock * Moved the database, otel and emails packages to be in internal-packages * Moved some Prisma code to the database package * Started using the RunEngine for triggering * Progress on run engine triggering, first waitpoint code * Create a delay waitpoint * Moved ZodWorker to an internal package so it can be used in the run engine as well as the webapp * Web app now uses the zod worker package * Added parseNaturalLanguageDuration to core/apps * internal-packages/zod-worker in the lockfile * Pass in the master queue, remove old rebalance workers code * Add masterQueue to TaskRun * Fixed the tests * Moved waitpoint code into the run engine, also the zod worker * Completing waitpoints * An experiment to create a new test container with environment * More changes to triggering * Started testing triggering * Test for a run getting triggered and being enqueued * Removed dequeueMessageInEnv * Update dev queue tests to use the shared queue function * Schema changes for TaskRunExecutionSnapshot * First execution snapshot when the run is created. Dequeue run function added to the engine * Separate internal package for testcontainers so they can be used elsewhere * Remove the simple queue and testcontainers from the run-engine. They’re going to be separate * Fix for the wrong path to the Prisma schem,a * Added the testcontainers package to the run-engine * redis-worker package, just a copy of the simple queue for now * The queue now uses Lua to enqueue dequeue * The queue now has a catalog and an invisible period after dequeuing * Added a visibility timeout and acking, with tests * Added more Redis connection logging, deleted todos * Visibility timeouts are now defined on the catalog and can be overridden when enqueuing * Dequeue multiple items at once * Test for dequeuing multiple items * Export some types to be used elsewhere * Partial refactor of the processor * First stab at a worker with concurrency and NodeWorkers * Don’t have a default visibility timeout in the queue * Worker setup and processing items in a simple test * Process jobs in parallel with retrying * Get the attempt when dequeuing * Workers do exponential backoff * Moved todos * DLQ functionality * DLQ tests * Same cluster for all keys in the same queue * Added DLQ tests * Whitespace * Redis pubsub to redrive from the worker * Fixed database paths * Fix for path to zod-worker * Fixes for typecheck errors, mostly with TS versions and module resolution * Redlock required a patch * Moved the new DB migrations to the new database package folder * Remove the run-engine package * Remove the RunEngine prisma schema changes * Delete triggerTaskV2 * Remove zodworker test script (no tests) * Update test-containers readme * Generate the client first * Use a specific version of the prisma package * Generate the prisma client before running the unit tests commit fc60947 Author: Dan <8297864+D-K-P@users.noreply.github.com> Date: Tue Oct 8 14:36:03 2024 +0100 Supabase database webhook example upgrade (#1386) * Added overview for guides and examples section and split them all out * New supabase guide wip * Updated images and improved docs * Trimmed the supabase prereqs * Supabase guide wip * more updates * Replaced old database webhook guide * Created one intro page and removed snippets * Updated guide sidebar titles * Code updates * More improvements * Updates and added images * Compressed image * Updated guides descriptions and edge function basic * Removed bold * Updated redirects * Fixed broken links * Updated intro commit 07f82ea Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 13:28:54 2024 +0100 Release 3.0.11 commit 13ebfcc Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Oct 8 13:24:38 2024 +0100 chore: Update version for release (#1381) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 2a04d17 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:24:23 2024 +0100 Simplify showLogs expression commit 002ae4b Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:29 2024 +0100 Fix dotenv overrides for dev runs (#1388) * override dashboard dev env vars with local .env * add changeset * add simple task for testing env vars commit 047cb00 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue Oct 8 09:22:05 2024 +0100 Disable schedules for deleted orgs on next tick (#1383) * disable schedules for deleted orgs * add debug logs commit 2c014f7 Author: James Ritchie <james@trigger.dev> Date: Sun Oct 6 13:02:00 2024 -0700 Override log retention (#1385) * set full log retention as admin * If run.logsDeletedAt is set, don’t bother getting the trace commit a69e04f Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 14:18:58 2024 +0100 Include push output in logs for self-hosted deploys (#1382) * include push output in logs * changeset commit c5488df Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Sat Oct 5 13:12:47 2024 +0100 Fix CLI downgrade check (#1380) * fix downgrade detection * remove unused semver package from webapp * add changeset commit 1caec27 Author: Eric Allam <eric@trigger.dev> Date: Fri Oct 4 15:33:35 2024 -0700 docs: Max duration (#1379) * maxDuration docs * Update the init command to set the maxDuration and include a commented out maxDuration in the config file commit e14c954 Author: Eric Allam <eallam@icloud.com> Date: Fri Oct 4 15:02:05 2024 -0700 Release 3.0.10 commit 8e61f5d Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Oct 4 14:59:07 2024 -0700 chore: Update version for release (#1378) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> commit 08db565 Author: Eric Allam <eallam@icloud.com> Date: Thu Oct 3 12:38:25 2024 -0700 improve the timed out description commit 6d08842 Author: Eric Allam <eric@trigger.dev> Date: Thu Oct 3 12:43:26 2024 -0700 feat: Add maxDuration to tasks (#1377) * WIP * Get max duration working on deployed runs * Actually set the timed out runs to status = TIMED_OUT * The client status for TIMED_OUT is now MAX_DURATION_EXCEEDED * New TimedOutIcon * Added new timedout icon * Add ability to opt-out of maxDuration with timeout.None * MAX_DURATION_EXCEEDED -> TIMED_OUT * changeset * Improved styling for the status tooltip content --------- Co-authored-by: James Ritchie <james@trigger.dev> commit 665ccf8 Author: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Thu Oct 3 12:33:18 2024 +0100 Update github actions and self-hosting docs commit 1ff7b86 Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 18:26:36 2024 -0700 Add max queue depth limits (#1376) * Add runs to an env queue, as well as the actual queue * Add queue size limit guard on triggering tasks commit c531a9d Author: Eric Allam <eric@trigger.dev> Date: Wed Oct 2 15:30:39 2024 -0700 fix: cleanup ttl expire run graphile jobs (#1373) * fix: remove ttl expire run graphile jobs when a run is started or completed * Update expireEnqueuedRun.server.ts commit 0bf500f Author: Matt Aitken <matt@mattaitken.com> Date: Wed Oct 2 15:30:16 2024 -0700 Prioritize finishing waited runs (#1375) * If a tree node is missing, estimate the size as zero * Task to test prioritizing finishing existing runs after triggerAndWaits * When requeuing a run with a checkpoint, put it in the queue with the parent run time so it’s correctly prioritized * The same change but if there’s no checkpoint * Revert "Squashed commit of the following:" This reverts commit b837b5a. * Removed console logs * cleaned up conditionals * Unlock free plan state * Fixed subscribe button if you’re already github verified * Simplified the downgrade reasons logic * made periodEnd required --------- Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com>
Summary by CodeRabbit
New Features
Documentation
video_transcriptions
table and updated code snippets for better usability.Chores