Skip to content
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

Add notice on sideEffects in deployment guide #680

Merged
merged 2 commits into from
May 7, 2024

Conversation

zcesur
Copy link
Contributor

@zcesur zcesur commented Oct 23, 2023

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Changelog

Added an extra step prompting users to include ./src/jobs/**/*.ts in sideEffects if needed

I might have an unconventional monorepo setup since noone else seems to have this issue 🤷‍♂️ But only after doing this did I manage to convince Next.js to not tree shake away my jobs


Screenshots

@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2023

⚠️ No Changeset found

Latest commit: 6418622

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ericallam
Copy link
Member

Interesting... I wonder if you could share a little more of your file structure and contents so we can track down why this wasn't working. Could you share the contents of the trigger API route file?

@zcesur
Copy link
Contributor Author

zcesur commented Oct 23, 2023

Here ya go:

// apps/console/src/pages/api/trigger.ts
import { createPagesRoute } from "@trigger.dev/nextjs";

import { client } from "~/jobs";

const { handler, config } = createPagesRoute(client);
export { config };

export default handler;


// apps/console/src/jobs/client.ts
import { Trigger } from "@algora/trigger";
export const client = Trigger.init();


// packages/trigger/src/client.ts
import { TriggerClient } from "@trigger.dev/sdk";
// ...
export const init = () =>
  new TriggerClient({
    id: id,
    apiKey: env.TRIGGER_API_KEY,
    apiUrl: env.TRIGGER_API_URL,
  });

I had also made a dummy project as I was trying to track this down. Just pushed it on Github if you wanna reproduce the issue:
https://github.com/zcesur/trigger-sideeffects-repro

@matt-aitken matt-aitken merged commit ff04c98 into triggerdotdev:main May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants