Skip to content

Commit 87a2eac

Browse files
Documentation edits made through Mintlify web editor
1 parent abd3dfe commit 87a2eac

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

docs/guides/frameworks/supabase-edge-functions-database-webhooks.mdx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ First, go to your Trigger.dev project and copy the `prod` secret key from the AP
105105

106106
![How to find your prod secret key](/images/api-key-prod.png)
107107

108-
Then, in Supabase, navigate to your settings page, click 'Edge functions' in the configurations menu, and then click the 'Add new secret' button.
108+
Then, in Supabase, navigate to your 'Project settings' page, click 'Edge functions' in the configurations menu, and then click the 'Add new secret' button.
109109

110110
Add `TRIGGER_SECRET_KEY` with the pasted value of your Trigger.dev `prod` secret key.
111111

@@ -115,7 +115,7 @@ Add `TRIGGER_SECRET_KEY` with the pasted value of your Trigger.dev `prod` secret
115115

116116
<Step title="Create a new edge function using the Supabase CLI">
117117

118-
We will call this example edge function `database-webhook`.
118+
Go back to your project, and create a new edge function. We will call it `database-webhook`.
119119

120120
```bash
121121
supabase functions new database-webhook
@@ -127,7 +127,7 @@ supabase functions new database-webhook
127127

128128
Replace the `database-webhook` placeholder code with the following:
129129

130-
```ts database-webhook/index.ts
130+
```ts /database-webhook/index.ts
131131
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
132132
import { tasks } from "npm:@trigger.dev/[email protected]/v3";
133133
// Import your task type from your /trigger folder
@@ -137,7 +137,6 @@ console.log("Hello from 'database-webhook' function!");
137137

138138
Deno.serve(async (req) => {
139139
const payload = await req.json();
140-
141140
await tasks.trigger<typeof helloWorldTask>("hello-world", "hello");
142141
console.log(payload ?? "No name provided");
143142

@@ -156,23 +155,23 @@ Deno.serve(async (req) => {
156155

157156
<Step title="Deploy your edge function using the Supabase CLI">
158157

159-
Go back to your project, and deploy your edge function with the following command:
158+
Now deploy your edge function with the following command:
160159

161160
```bash
162161
supabase functions deploy edge-function-trigger
163162
```
164163

165-
Follow the CLI instructions and once complete you should now see your new edge function deployment in your Supabase edge functions dashboard.
164+
Follow the CLI instructions and once complete you should see your new edge function deployment in your Supabase edge functions dashboard.
166165

167166
</Step>
168167

169168
<Step title="Create a new database">
170169

171-
Next, in your Supabase dashboard, click on 'Table Editor' in the left-hand menu.
170+
Next, in your Supabase dashboard, click on 'Table Editor' in the left-hand menu and create a new table. In this example we will call our table `skynet`.
171+
172172

173173
[How to create a new table]()
174174

175-
Create a new table called `skynet`.
176175

177176
Add a new column called `name` with the type `text`.
178177

@@ -184,17 +183,17 @@ Add a new column called `name` with the type `text`.
184183

185184
By default, Supabase edge functions require a JSON Web Token (JWT) in the authorization header. This is to ensure that only authorized users can access your edge functions.
186185

187-
Go to your Supabase dashboard, click 'Project settings', 'API' tab, and copy the `anon` `public` API key from the table.
186+
In your Supabase dashboard, click 'Project settings', then the 'API' tab, and copy the `anon` `public` API key from the table.
188187

189188
[How to find your Supabase API keys]()
190189

191-
Then, go to 'Database' in the Supabase dashboard, click on 'Webhooks', and then click 'Create a new hook'.
190+
Then, go to 'Database' click on 'Webhooks', and then click 'Create a new hook'.
192191

193192
[How to create a new webhook]()
194193

195194
Call the hook `edge-function-hook`:
196195

197-
1. Select the new table you have created: `public``skynet`.
196+
1. Select the new table you have created: `public` `skynet`.
198197
2. Choose the `insert` event.
199198
3. Under 'Webhook configuration', select 'Supabase Edge functions'
200199
4. Under 'Edge function', choose `POST` and select the edge function you have created: `database-webhook`.
@@ -235,13 +234,13 @@ yarn dlx trigger.dev@beta deploy
235234

236235
<Step title="Trigger your new database webhook edge function">
237236

238-
In your Supabase dashboard, click on 'Table Editor' in the left-hand menu, and then click on the `skynet` table.
237+
Back in your Supabase dashboard, click on 'Table Editor' in the left-hand menu, and then click on the `skynet` table.
239238

240239
Click 'insert', and add a new item under `name`, with the value `Sarah Connor`.
241240

242241
[How to insert a new row]()
243242

244-
Go back to your edge function dashboard, and you should see a new run of your edge function, under 'Logs'.
243+
Go back to your edge function dashboard, and you should see a new run of your `database-webhook` edge function, under 'Logs'.
245244

246245
[How to view the logs]()
247246

0 commit comments

Comments
 (0)