Skip to content

fix(webapp): db seed script#4137

Merged
carderne merged 1 commit into
mainfrom
fix/db-seed
Jul 3, 2026
Merged

fix(webapp): db seed script#4137
carderne merged 1 commit into
mainfrom
fix/db-seed

Conversation

@carderne

@carderne carderne commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

pnpm run db:seed failed with SyntaxError: The requested module './app/models/organization.server' does not provide an export named 'createOrganization', even though that export exists. Renaming the seed entry
point from seed.mts to seed.ts runs it as CommonJS and fixes the failure.
No seed logic changes.

Root cause

seed.mts is an ES module, but the server modules it imports (.ts files, and
no package declares "type": "module") resolve as CommonJS. tsx compiles those
to CommonJS using esbuild's getter-based export shape
(Object.defineProperty(exports, name, { get })), which Node's
cjs-module-lexer does not detect when it links the ESM importer. The named
exports look absent, so linking throws before any code runs.

The seed only ever needed the .mts extension: it has no top-level await and
no import.meta. Running it as .ts keeps the whole import chain CommonJS to
CommonJS and never crosses the lexer boundary. Verified the seed runs to
completion after the change.

Possibly caused by Node 22 upgrade?


This is part 1 of 2 in a stack made with GitButler:

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8f2878c

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@carderne carderne marked this pull request as ready for review July 3, 2026 10:14
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The db:seed npm script in apps/webapp/package.json is updated to invoke seed.ts instead of seed.mts as the database seeding entrypoint.

Changes

Cohort / File(s) Summary
Seed script update — apps/webapp/package.json Changed db:seed script to run tsx seed.ts instead of tsx seed.mts

Related Issues: None provided.

Related PRs: None provided.

Suggested Labels: None

Suggested Reviewers: None

Poem: A rabbit hopped through package.json's field, / Swapped .mts for .ts, a small change revealed, / Seeds will now sprout from a different file, / A tiny hop, but done in style.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix well, but it does not follow the required template sections like Closes, Testing, Changelog, or Screenshots. Add the required template sections, include Closes #, and fill in Testing, Changelog, and Screenshots entries.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is related to the main change, but it is broad and omits the specific seed entrypoint rename.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/db-seed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@1stvamp 1stvamp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@carderne carderne merged commit 20f9c78 into main Jul 3, 2026
35 checks passed
@carderne carderne deleted the fix/db-seed branch July 3, 2026 11:45
1stvamp added a commit that referenced this pull request Jul 3, 2026
## Summary

Getting the CLI talking to a local instance meant the browser magic-link
login, which is no good when you're driving things headlessly (an agent,
a container, or just no browser to hand). The seed already prints dev
secret keys for the batch-limit orgs, so it now also mints a personal
access token for the seeded `local@trigger.dev` user and prints a
ready-to-run `export TRIGGER_ACCESS_TOKEN=...` next to them.

Re-seeding stays idempotent: it decrypts and reprints the existing
`local-dev-cli` token rather than piling up a new one on every run.

<!-- GitButler Footer Boundary Top -->
---
This is **part 2 of 2 in a stack** made with GitButler:
- <kbd>&nbsp;2&nbsp;</kbd> #4135 👈 
- <kbd>&nbsp;1&nbsp;</kbd> #4137
<!-- GitButler Footer Boundary Bottom -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

2 participants