Skip to content

Non-deterministic CLI behavior #11081

Closed
Closed

Description

@drewbo

Describe the Bug

Running CLI commands produces different results at different times with no other system changes. It's possible this is due to specific system constraints but no errors are produced. Example:

❯ pnpm payload migrate:status

> [email protected] payload
> cross-env NODE_OPTIONS=--no-deprecation payload migrate:status

<no output>
<wait 30 seconds>

❯ pnpm run payload migrate:status

> [email protected] payload
> cross-env NODE_OPTIONS=--no-deprecation payload migrate:status

[11:15:33] WARN: No email adapter provided. Email will be written to console. More info at https://payloadcms.com/docs/email/overview.
[11:15:33] INFO: Reading migration files from <redacted>/pages-editor/src/migrations
┌─────────────────┬───────┬─────┐
│            Name │ Batch │ Ran │
├─────────────────┼───────┼─────┤
│ 20250210_142843 │       │  No │
└─────────────────┴───────┴─────┘
[11:15:33] INFO: Done.

Link to the code that reproduces this issue

https://github.com/cloud-gov/pages-editor/

Reproduction Steps

This happened running a variety of migration commands as shown above. The database is PostGRES running locally

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 20.18.1
  npm: 10.8.2
  Yarn: 1.22.22
  pnpm: 10.2.1
Relevant Packages:
  payload: 3.20.0
  next: 15.1.6
  @payloadcms/db-postgres: 3.20.0
  @payloadcms/email-nodemailer: 3.20.0
  @payloadcms/graphql: 3.20.0
  @payloadcms/live-preview: 3.20.0
  @payloadcms/live-preview-react: 3.20.0
  @payloadcms/next/utilities: 3.20.0
  @payloadcms/payload-cloud: 3.20.0
  @payloadcms/plugin-form-builder: 3.20.0
  @payloadcms/plugin-nested-docs: 3.20.0
  @payloadcms/plugin-redirects: 3.20.0
  @payloadcms/plugin-search: 3.20.0
  @payloadcms/plugin-seo: 3.20.0
  @payloadcms/richtext-lexical: 3.20.0
  @payloadcms/translations: 3.20.0
  @payloadcms/ui/shared: 3.20.0
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Fri Nov 15 15:13:56 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T8103
  Available memory (MB): 16384
  Available CPU cores: 8

Activity

  1. added
    status: needs-triage
    validate-reproduction
    on Feb 10, 2025
  2. removed
    validate-reproduction
    on Feb 10, 2025
  3. jmikrut commented on Feb 10, 2025

    @jmikrut
    Member

    Hey @drewbo — we will look into this immediately. Thanks for the heads-up!

  4. jmikrut commented on Feb 10, 2025

    @jmikrut
    Member

    An update - this is likely caused by your use and import from @lexical/markdown - see this PR for a change we had to make because of that package:

    #9382

    The long and short is that for some reason, that package breaks tsx transpilation and Node fails silently. It looks to be because of prism and some type of circular dependency scenario with async imports. Low-level node stuff.

    @AlessioGr will know more here but here's what you can do for now:

    Change this import:

    https://github.com/cloud-gov/pages-editor/blob/main/src/collections/Posts/index.ts#L10
    

    To this:

    import { $convertToMarkdownString, TRANSFORMERS } from '@payloadcms/richtext-lexical/lexical/markdown';
    

    I have confirmed that this resolves the issue in your project.

    We re-export these utilities for this exact reason. Would love for Lexical to look into this themselves (we've reported it) so others won't fall into this insane "gotcha" but for now, this is a workaround. Will mark this as a discussion so others can benefit from this!

  5. locked and limited conversation to collaborators on Feb 10, 2025
  6. converted this issue into a discussion #11095 on Feb 10, 2025
  7. removed
    status: needs-triage
    on Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions