You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This happens because the code in getTSConfigPaths() silently returns undefined for configPath when the path alias is missing, which later causes a path resolution error.
Hi @marwinhormiz thanks for raising this and apologies for our delayed response!
I no longer see this behavior on the latest version v3.37.0 - it also appears that the reproduction you linked no longer exists.
I'm going to close this issue as it is several versions old now and I am unable to reproduce - if you still experience this behavior on v3.37.0 please feel free to open a new issue!
Describe the Bug
When the
@payload-config
path alias is missing from tsconfig.json'scompilerOptions.paths
, the package fails with a cryptic error:node:path:1464
validateString(path, 'path');
^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at Object.extname (node:path:1464:5)
at findConfig (/home/marwinhormiz/Documents/bygglov/node_modules/.pnpm/payload@3.4.0_graphql@16.9.0_monaco-editor@0.52.0_react-dom@19.0.0-rc-66855b96-20241106_react_re2uwt7p7ymmoimatcnocwcioe/node_modules/payload/src/config/find.ts:70:12)
at bin (/home/marwinhormiz/Documents/bygglov/node_modules/.pnpm/payload@3.4.0_graphql@16.9.0_monaco-editor@0.52.0_react-dom@19.0.0-rc-66855b96-20241106_react_re2uwt7p7ymmoimatcnocwcioe/node_modules/payload/dist/bin/index.js:46:24)
at start (file:///home/marwinhormiz/Documents/bygglov/node_modules/.pnpm/payload@3.4.0_graphql@16.9.0_monaco-editor@0.52.0_react-dom@19.0.0-rc-66855b96-20241106_react_re2uwt7p7ymmoimatcnocwcioe/node_modules/payload/bin.js:30:13) {
code: 'ERR_INVALID_ARG_TYPE'
}
This happens because the code in
getTSConfigPaths()
silently returnsundefined
forconfigPath
when the path alias is missing, which later causes a path resolution error.Link to file
Current Behavior
@payload-config
path alias is missing,configPath
becomesundefined
undefined
is passed to path operations causing a TypeErrorExpected Behavior
Either:
@payload-config
path alias is required in tsconfig.jsonLink to the code that reproduces this issue
https://github.com/marwinhormiz/config-path-error
Reproduction Steps
@payload-config
path alias from tsconfig.json:Which area(s) are affected? (Select all that apply)
area: core
Environment Info
The text was updated successfully, but these errors were encountered: