Feat: Detect if a Next.js project is running on the specified port before opening a tunnel - #214
Conversation
🦋 Changeset detectedLatest commit: f006d67 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@ericallam I have done the changes, but not sure how to test it. What i'm doing right now? |
|
This looks good to me. Basically we want to actually make sure there is a local server running with the Trigger.dev client configured correctly before we call To test it, you should first build the CLI and watch for changes: cd packages/cli
pnpm run devOpen a new Terminal window and run the webapp locally and then create a new project in the dashboard. Copy out the dev API key. Next, create a new (temporary) nextjs app in the examples directory: pnpm create next-app@latestFollow the prompts to create a TypeScript project using the App Dir. Then once that's finished, add the {
"devDependencies": { "@trigger.dev/cli": "workspace:*" }
}Then you should (in a new Terminal window) cd into the example and do the following: cd examples/your-newly-created-nextjs-project
pnpm i
pnpm exec trigger-cli initSelect self-hosted and enter Once that's done, you should be able to run: pnpm exec trigger-cli devAnd because you aren't yet running your newly created Next.js server locally, then the code you added should log and exit out the dev command. Then you should actually run the Next.js server locally, and try the |
|
Also, it would be amazing to get the above instructions added to the CONTRIBUTING.md guide under a section towards the end called something like "Testing CLI changes". If you can do this afterwards in a separate PR I'll definitely tip you handsomely 👍 |
|
Oh, and don't forget to cleanup and delete that temporary Next.js project before committing anything |
|
Okay great! Will also add to CONTRIBUTING.md in the next pr 👍 |
|
Tested the changes and made some changes. Working fine 👍 Next, will raise a pr adding the above things you told in CONTRIBUTING.md |
|
Okay, now its working, no idea what the issue was 😅 |
@ericallam I tried this, the dev command seems to be working fine. It didn't fail. |
|
Awesome! Can you add a changeset to this PR for |
|
Just added it |


Fixes #210
/claim #210
Detect if a Next.js project is running on the specified port before opening a tunnel