migrate-to-meteor-3
Use when migrating a Meteor 2.x application to Meteor 3.x. Triggers on callAsync, *Async Mongo, removed Fibers, implicit-global ReferenceError, lost Blaze reactivity, a publish function returning a Promise, a scheduler dropping a Promise, a read API receiving update modifiers, async allow/deny, an Iron Router controller not running, "Method stub took too long", Atmosphere resolution, Express 5 WebApp handlers, lost async context, rawCollection callbacks, TypeScript declaration failures during upgrades, useTracker, and useSubscribe. Use this skill when the user asks about upgrading Meteor, async caller propagation, iterators with await, or replacing and forking packages. Standalone declarations and type-checking belong to meteor-typescript.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- migrate-to-meteor-3
- license
- MIT
- metadata
- { "area": "migration", "kind": "knowledge", "author": "meteor", "bundle": [ "migration" ], "meteor": ">=3.0", "tagline": "Migrate a Meteor 2.x app to 3.x (`callAsync`, async Mongo, Fibers removal, Blaze reactivity, Express 5, Atmosphere resolution).", "docs_synced_at": "2026-10-07" }
- description
- Use when migrating a Meteor 2.x application to Meteor 3.x. Triggers on callAsync, *Async Mongo, removed Fibers, implicit-global ReferenceError, lost Blaze reactivity, a publish function returning a Promise, a scheduler dropping a Promise, a read API receiving update modifiers, async allow/deny, an Iron Router controller not running, "Method stub took too long", Atmosphere resolution, Express 5 WebApp handlers, lost async context, rawCollection callbacks, TypeScript declaration failures during upgrades, useTracker, and useSubscribe. Use this skill when the user asks about upgrading Meteor, async caller propagation, iterators with await, or replacing and forking packages. Standalone declarations and type-checking belong to meteor-typescript.
02 资源文件 15
- 参考文档references/async-cheatsheet.md2.5 KB
- 参考文档references/async-rewrites.md8.1 KB
- 参考文档references/call-vs-callAsync.md3.5 KB
- 参考文档references/client-reactivity.md4.8 KB
- 参考文档references/community-case-studies.md3.5 KB
- 参考文档references/eval-cases.md17.4 KB
- 参考文档references/js-iterators.md2.6 KB
- 参考文档references/module-system.md3.6 KB
- 参考文档references/other-breaking-changes.md8.4 KB
- 参考文档references/package-triage.md6.3 KB
- 参考文档references/publications.md4.8 KB
- 参考文档references/react-migration.md3.8 KB
- 参考文档references/removed-functions.md3.6 KB
- 参考文档references/typescript-migration.md2.0 KB
- 参考文档references/webapp-express.md4.1 KB
03 SKILL.md 正文
Migrate a Meteor 2.x application to Meteor 3.x
Meteor 3 removed Fibers. Server-side Mongo APIs are async. The module system enforces strict mode. Client reactivity inside async code needs care. Atmosphere packages often need forking or replacement. Approach the migration in phases. Do not flip the framework version flag first.
Recommended strategy
For Meteor 3.6, prepare retained local data under the previous release before updating.
- Update the project to the latest 2.x release.
- Run the app with
WARN_WHEN_USING_OLD_API=true meteor run. The console logs every sync-API call that needs an async sibling, giving you a to-do list before the framework flip. - Migrate server-side sync Mongo calls to
*Asyncsiblings while still on 2.x. Trace each changed function through every server-side caller: await where the caller consumes the value, forward Promises deliberately, and restructure sync-only boundaries. Stop only at an async-capable framework boundary. Seereferences/async-rewrites.mdandreferences/call-vs-callAsync.md. A community jscodeshift codemod automates the easy cases, but it misses non-standard collection imports (for example,meteor/<publisher>:collections). Review the diff by hand, then audit callback Promise ownership and collection argument shapes. - Audit Atmosphere packages. Find replacements or fork outdated ones;
pin
api.versionsFrom(['2.x', '3.0']). Seereferences/package-triage.md. Save.meteor/versionsand npm lockfile checkpoints so package-major changes remain distinguishable from Meteor. - Upgrade to the selected Meteor 3.x release.
- Sweep implicit globals; rewrite to
constorexport/import. Seereferences/module-system.md. - Audit Blaze helpers and
Tracker.autorunblocks for lost reactivity afterawait. Seereferences/client-reactivity.md. - Replace iterators that contain
await(forEach,map,filter) withfor...oforPromise.all. Seereferences/js-iterators.md. - Audit publications using internal cursor APIs (
_cursorDescription, manualsub.added) and framework handlers that read invocationthis. Both synchronous and async publish handlers may return cursors; keep cursor transforms synchronous and use ordinary functions when Meteor must bindthis. When a package patchesMeteor.publishwith anEnvironmentVariable, scopepublish.callat the wrapper's top level, not inside the invoked handler. Verify invocation context before and afterawait. Seereferences/publications.mdandreferences/other-breaking-changes.md. - For TypeScript projects, inspect the target release and existing declaration
provider. Keep working
@types/meteororzodern:typessetups. Meteor 3.6 adds explicit native opt-in throughmeteor types; earlier releases retain the legacy workflow. Seereferences/typescript-migration.md, then usemeteor-typescriptfor provider changes and checking. - For React projects, decide whether to adopt the Suspense-aware
react-meteor-dataimport. Seereferences/react-migration.md, then usemeteor-reactfor current hook, scaffold, and build guidance.
Symptom router
| Symptom | Reference |
|---|---|
TypeError: Collection.findOne is not a function |
references/async-rewrites.md |
Method returns undefined or returns a Promise |
references/async-rewrites.md |
Downstream caller receives or reads from a Promise |
references/async-rewrites.md |
| Cron, hook, timer, or event callback drops a Promise | references/async-rewrites.md |
Read method receives $set, $push, or another modifier |
references/async-rewrites.md |
allow / deny validator needs an async database read |
references/async-rewrites.md |
Meteor.call callback never fires |
references/call-vs-callAsync.md |
ReferenceError: X is not defined at startup |
references/module-system.md |
| Template renders, no data, Minimongo empty | references/module-system.md |
| Iron Router controller silently does not run | references/module-system.md |
{{> partial}} renders nothing in Blaze |
references/module-system.md |
| Page renders but live data never updates | references/client-reactivity.md |
Blaze helper returns a Promise |
references/client-reactivity.md |
Cursor transform errors with "returned a Promise" |
references/publications.md |
sub.added writes never reach the client |
references/publications.md |
Method or publication loses this.userId |
references/publications.md |
| Atmosphere package fails to resolve or build | references/package-triage.md |
forEach/map/filter with await skips items |
references/js-iterators.md |
Middleware on WebApp.connectHandlers not firing |
references/webapp-express.md |
| Route uses an unnamed wildcard after Meteor 3.1 | references/webapp-express.md |
rawCollection callback never fires |
references/other-breaking-changes.md |
Patched publication loses Meteor.userId() or async context |
references/other-breaking-changes.md |
meteor reset did not wipe the local Mongo |
references/other-breaking-changes.md |
Method stub (X) took too long console warning |
references/call-vs-callAsync.md |
"Cannot enlarge memory array" during meteor update |
references/other-breaking-changes.md |
External callback lost this.userId or env vars |
references/other-breaking-changes.md |
Monkey-patched Meteor.publish never runs |
references/other-breaking-changes.md |
meteor/* imports resolve to any in TypeScript |
references/typescript-migration.md |
useTracker or useSubscribe not re-running |
references/react-migration.md |
Anti-patterns
- Do not run
meteor update --release=3first. Async-convert and package-triage on 2.x first. - Do not global-replace
findOnewithfindOneAsync. Many callers need rewriting, not justawait. - Do not mechanically rewrite client Minimongo calls to async. Both APIs work
on the client. Prefer sync calls in naturally synchronous Blaze and Tracker
code; use async calls in shared or already-async flows. Wrap reactive reads
after an
awaitwithTracker.withComputation. - Do not rely on Iron Router controller naming-convention lookup. Pass
controller:explicitly on every route. - Do not mix
awaitand.then()in the same function. Pick one. - Do not assume implicit globals work. Every top-level identifier in 3.x
must be
const,let, orexport-ed. - Do not invent async replacements.
Meteor.userId()remains synchronous inside methods and publications; there is noMeteor.userIdAsync(). - Do not use an arrow as a method or publication handler when it reads
framework-bound
this. An arrow ignores the invocation context Meteor supplies. - Do not rewrite
api.addFilesorapi.exportonly because the app moved to Meteor 3. They remain supported for Atmosphere packages.
See also
- Async:
async-rewrites.md,call-vs-callAsync.md,async-cheatsheet.md,js-iterators.md,removed-functions.md. - Runtime:
module-system.md,client-reactivity.md,publications.md,webapp-express.md,other-breaking-changes.md. - Project:
package-triage.md,typescript-migration.md,react-migration.md,eval-cases.md. - Current Meteor React integration after the upgrade:
meteor-react.
For requested case studies, read
references/community-case-studies.md; use the symptom router for fixes.
04 同仓库更多 Skills
migrate-to-rspack
Use when migrating an existing Meteor app to Rspack (Meteor 3.4+), or upgrading Rspack 1 to 2 on Meteor 3.6. Triggers on nested imports, mainModule entry points, server-only apps, replacing fourseven:scss / meteor/less / coffeescript / jorgenvatle:vite / zodern:melte with loaders, Svelte/TypeScript preprocessing or Lingui SWC plugin failures after upgrade, CommonJS default-import interop, module.exports in client graphs, Node built-ins in browser code, _build / build-assets / build-chunks, .meteorignore hiding handoff files, dynamic chunks under ROOT_URL, meteor.modules for CSS/HTML, resolve.symlinks or resolve.alias migration, automatic dependency updates and immutable CI/Docker builds. Use this skill when the user asks about migration compatibility or a build plugin's Rspack replacement. For new-app setup and rspack.config.js helpers, use meteor-modern-build-stack instead.
meteor-typescript
Use when setting up or repairing Meteor application declarations, TypeScript configuration, JavaScript IntelliSense, or local and CI type-checking. Triggers on meteor types, meteor/* imports resolving to any, missing declarations, duplicate Meteor identifiers, zodern:types, @types/meteor, .meteor/types, tsconfig.json, jsconfig.json, and tsc --noEmit in a Meteor app. Use this skill when choosing or migrating declaration providers without changing the app's runtime or bundler. For a Meteor 2-to-3 runtime migration use migrate-to-meteor-3 first; for SWC/Rspack compilation use meteor-modern-build-stack or migrate-to-rspack. General TypeScript language questions and Atmosphere declaration publishing are outside this app scope.
meteor-testing
Use when setting up, designing, writing, or repairing tests and test harnesses in a Meteor 3 app. Triggers on meteortesting:mocha, --driver-package, TEST_WATCH, TEST_BROWSER_DRIVER, MOCHA_GREP, meteor.testModule, focused tests, .only, Meteor.server.method_handlers, Meteor.server.publish_handlers, DDP.connect, --full-app integration mode, sinon, async test signatures, Playwright/Cypress E2E. Use this skill when the user asks about test runners, asks about testing publications, or asks about Jest vs Mocha in Meteor. For a failing, hanging, or flaky test whose failing layer or root cause is unknown, use meteor-debugging before changing the test or app.
meteor-security
Use when auditing or hardening a Meteor 3 application. Triggers on missing check() on method arguments, missing this.userId guards on publications, browser-policy CSP, DDPRateLimiter rules, oauth-encryption via Accounts.config oauthSecretKey, audit-argument-checks, allow/deny legacy patterns, BrowserPolicy.content.disallowInlineScripts, BrowserPolicy.framing.disallow. Use this skill when the user asks about hardening, asks about a security review, or asks about CSP for a third-party script (Stripe, Google Maps, fonts).
meteor-react
Use when building or debugging React interfaces in Meteor 3: meteor create --react, createRoot, JSX or TSX entry points, Rspack React detection, Fast Refresh, react-meteor-data, useTracker, useSubscribe, useFind, withTracker, Suspense, and Tracker.withComputation. Triggers on isLoading being treated as a boolean, useFind receiving fetch(), stale closure inputs, duplicate tracker side effects, unstable Suspense keys, lost reactivity after await, state reset after refresh, or React tests leaking computations. Use this skill when the user asks about a React skeleton, React Compiler, React-specific rspack.config rules, reactive data hooks, or classic versus Suspense integration. Route general bundler configuration to meteor-modern-build-stack and Meteor 2 upgrades to migrate-to-meteor-3.
meteor-mongo-minimongo
Use when authoring or debugging Mongo queries in Meteor 3. Triggers on Mongo.Collection, find/findOne, server async vs client Minimongo sync, oplog vs change streams, indexes, selectors, modifiers, projections. Use this skill when the user asks about Mongo on the server or asks about Minimongo on the client.