Skip to content

generate:importmap and generate:types don't have process.exit #13744

Closed

Description

@juanpablob

Describe the Bug

Hello dear community! :)
For some reason, out of the blue, whenever I try to run generate:types the process hangs and it never ends, with no exit code whatsoever. Eventually it generates the types, yes, but the process doesn't finish at all. Same with generate:importmap.

However, whenever I run pnpm dev and Payload starts, the types are generated without any problem! The problem arises whenever I try to run the command directly.

Looking at the code base, specifically at payload/packages/payload/src/bin/index.ts around lines 97-197 I found this:

  if (script.startsWith('migrate')) {
    return migrate({ config, parsedArgs: args }).then(() => process.exit(0))
  }

  if (script === 'generate:types') {
    return generateTypes(config)
  }

  if (script === 'generate:importmap') {
    return generateImportMap(config)
  }

While migrate has a process.exit the others don't.

I can't possibly debug what might be wrong with my installation of Payload if the commands don't exit with any error or if the errors are not being handled :(

Thank you for looking into this!

Link to the code that reproduces this issue

Reproduction Steps

I can't reproduce the issue. I made a fresh installation of Payload and generate:types works fine, I'm not sure what's wrong with my installation, it stopped working out of the blue, but whatever it is, I'm not getting any error and certainly something might be happening that prevents from finishing the operation and that exception is not being handled. — i.e: I have generate:types in a CI pipeline at github and the whole Workflow hangs because the process can't exit, not even to say "error".

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

area: core

Environment Info

Binaries:
  Node: 22.14.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.12.4
Relevant Packages:
  payload: 3.54.0
  next: 15.3.0
  @payloadcms/db-postgres: 3.54.0
  @payloadcms/email-resend: 3.54.0
  @payloadcms/graphql: 3.54.0
  @payloadcms/next/utilities: 3.54.0
  @payloadcms/plugin-cloud-storage: 3.54.0
  @payloadcms/plugin-multi-tenant: 3.54.0
  @payloadcms/richtext-lexical: 3.54.0
  @payloadcms/storage-uploadthing: 3.54.0
  @payloadcms/translations: 3.54.0
  @payloadcms/ui/shared: 3.54.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8

Activity

  1. added
    status: needs-triage
    validate-reproduction
    on Sep 8, 2025
  2. github-actions commented on Sep 8, 2025

    @github-actions
    Contributor

    Please add a reproduction in order for us to be able to investigate.

    Depending on the quality of reproduction steps, this issue may be closed if no reproduction is provided.

    Why was this issue marked with the invalid-reproduction label?

    To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository created with create-payload-app@latest -t blank or a forked/branched version of this repository with tests added (more info in the reproduction-guide).

    To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue. Ensure your reproduction does not depend on secrets, 3rd party registries, private dependencies, or any other data that cannot be made public. Avoid a reproduction including a whole monorepo (unless relevant to the issue). The easier it is to reproduce the issue, the quicker we can help.

    Please test your reproduction against the latest version of Payload to make sure your issue has not already been fixed.

    I added a link, why was it still marked?

    Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

    Useful Resources

  3. removed
    validate-reproduction
    on Sep 8, 2025
  4. juanpablob commented on Sep 8, 2025

    @juanpablob
    Author

    I'm sorry that I could not provide a link for reproducing the error, because I simply cannot reproduce the error because I literally have no information about what's going on if the process doesn't show any error, if that makes sense? I can't debug if no information is given. Thank you!

  5. andershermansen commented on Sep 15, 2025

    @andershermansen
    Contributor

    I also have this issue in one of my projects. I have also been unable to pinpoint what actually causes it.
    lsof shows no obvious open files, and trying to attach a node process debugger also did not reveal anything for me.

    I created a PR to just exit the process as has been done for jobs before. Hope payload team will accept it.

  6. andershermansen commented on Sep 15, 2025

    @andershermansen
    Contributor

    Should be fixed by #13564

  7. DanRibbens commented on Sep 19, 2025

    @DanRibbens
    Contributor

    Can somebody verify this has been fixed by v3.56.0?

  8. removed
    status: needs-triage
    on Sep 19, 2025
  9. andershermansen commented on Sep 19, 2025

    @andershermansen
    Contributor

    @DanRibbens Yes, the project I had with same issue had this fixed with 3.56.0.

  10. AlessioGr commented on Sep 19, 2025

    @AlessioGr
    Member

    Fixed by #13564

  11. github-actions commented on Sep 27, 2025

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  12. locked as resolved and limited conversation to collaborators on Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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