Skip to content

Commit 35c8e35

Browse files
committed
Added snippets to the nextjs guide
1 parent 9d1398f commit 35c8e35

File tree

1 file changed

+5
-49
lines changed

1 file changed

+5
-49
lines changed

docs/guides/frameworks/nextjs.mdx

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import TriggerTaskNextjs from "/snippets/trigger-tasks-nextjs.mdx";
1515
import NextjsTroubleshootingMissingApiKey from "/snippets/nextjs-missing-api-key.mdx";
1616
import NextjsTroubleshootingButtonSyntax from "/snippets/nextjs-button-syntax.mdx";
1717
import WorkerFailedToStartWhenRunningDevCommand from "/snippets/worker-failed-to-start.mdx";
18+
import AddEnvironmentVariables from "/snippets/add-environment-variables.mdx";
19+
import DeployingYourTask from "/snippets/deplopying-your-task.mdx";
1820

1921
<Note>This guide can be followed for both App and Pages router as well as Server Actions.</Note>
2022

@@ -66,7 +68,7 @@ Here are the steps to trigger your task in the Next.js App and Pages router and
6668
//tasks.trigger also works with the edge runtime
6769
//export const runtime = "edge";
6870

69-
export async function GET(request: Request) {
71+
export async function GET() {
7072
const handle = await tasks.trigger<typeof helloWorldTask>(
7173
"hello-world",
7274
"James"
@@ -242,55 +244,9 @@ Here are the steps to trigger your task in the Next.js App and Pages router and
242244

243245
</Tabs>
244246

245-
## Add your environment variables (optional)
247+
<AddEnvironmentVariables/>
246248

247-
If you have any environment variables in your tasks, be sure to add them in the dashboard so deployed code runs successfully. In Node.js, these environment variables are accessed in your code using `process.env.MY_ENV_VAR`.
248-
249-
In the sidebar select the "Environment Variables" page, then press the "New environment variable"
250-
button. ![Environment variables page](/images/environment-variables-page.jpg)
251-
252-
You can add values for your local dev environment, staging and prod. ![Environment variables
253-
page](/images/environment-variables-panel.jpg)
254-
255-
You can also add environment variables in code by following the steps on the [Environment Variables page](/deploy-environment-variables#in-your-code).
256-
257-
## Deploying your task in Next.js
258-
259-
For this guide, we'll manually deploy your task by running the [CLI deploy command](/cli-deploy) below. Other ways to deploy are listed in the next section.
260-
261-
<CodeGroup>
262-
263-
```bash npm
264-
npx trigger.dev@latest deploy
265-
```
266-
267-
```bash pnpm
268-
pnpm dlx trigger.dev@latest deploy
269-
```
270-
271-
```bash yarn
272-
yarn dlx trigger.dev@latest deploy
273-
```
274-
275-
</CodeGroup>
276-
277-
### Other ways to deploy
278-
279-
<Tabs>
280-
281-
<Tab title="GitHub Actions">
282-
283-
Use GitHub Actions to automatically deploy your tasks whenever new code is pushed and when the `trigger` directory has changes in it. Follow [this guide](/github-actions) to set up GitHub Actions.
284-
285-
</Tab>
286-
287-
<Tab title="Vercel Integration">
288-
289-
We're working on adding an official [Vercel integration](/vercel-integration) which you can follow the progress of [here](https://feedback.trigger.dev/p/vercel-integration-3).
290-
291-
</Tab>
292-
293-
</Tabs>
249+
<DeployingYourTask/>
294250

295251
## Troubleshooting
296252

0 commit comments

Comments
 (0)