Skip to content

[Bug]: SWC Error: base_dir must be absolute & Error "db" is not allowed #83

@ainsleyclark

Description

@ainsleyclark

Package name

create-payload-api-docs
payload-openapi

What happened?

I'm wanting to generate an openapi spec from the CLI tool.

When running the command npx create-payload-api-docs --config=src/payload.config.ts from a PayloadCMS directory, I encountered the following error related to the SWC transpiler:

thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.180.13/src/path.rs:122:13:
base_dir(``) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly...

By adding a simple .swrc file, it seems to start working, but there is no mention of this in the documentation:

{
  "$schema": "https://json.schemastore.org/swcrc",
  "jsc": {
    "baseUrl": "./",
  },
  "module": {
    "type": "es6"
  }
}

After getting passed this, I think recieve other errors in the terminal:

[09:54:29] ERROR (payload): There were 4 errors validating your Payload config
[09:54:29] ERROR (payload): 1: "editor" is not allowed
[09:54:29] ERROR (payload): 2: "db" is not allowed
[09:54:29] ERROR (payload): 3: Collection "payload-migrations" > "graphQL" must be of type object
[09:54:29] ERROR (payload): 4: Collection "payload-migrations" > "endpoints" must be an array

Thanks in advance.

What did you expect

No issue, it generates the docs.

Setps to reproduce

Create a blank application in Payload and add a simple content type, run the commands indicated above.

Tool version

Latest

Payload version

2.0.0

Node version

v18.11.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions