Skip to content

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

@juanpablob

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

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