I was setting up an old project again on Railway, the same project that used to work stopped working and I was debugging for 3 hours. I narrowed down the error to Payload version.
Old version I had
1.2.4
but after upgrading to
1.5.9
I started getting this error:
#13 4.223 Error: unknown field `cwd`
#13 4.223 at module.exports.__wbindgen_error_new (/app/node_modules/@swc/wasm/wasm.js:446:17)
Is there a breaking change from 1.2.4 to 1.5.9?
here are the packages I have, I updated all of them
"dependencies": {
"dotenv": "16.0.3",
"express": "4.18.2",
"payload": "1.5.9"
},
"devDependencies": {
"@types/express": "4.17.15",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@typescript-eslint/eslint-plugin": "5.48.2",
"@typescript-eslint/parser": "5.48.2",
"copyfiles": "2.4.1",
"cross-env": "7.0.3",
"eslint": "8.32.0",
"eslint-config-prettier": "8.6.0",
"eslint-config-standard": "17.0.0",
"eslint-import-resolver-typescript": "3.5.3",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-n": "15.6.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.32.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-standard": "5.0.0",
"nodemon": "2.0.20",
"ts-node": "10.9.1",
"typescript": "4.9.4"
}
Hi @generator101 - there have been breaking changes in 1.4.0 and 1.3.0, you can see more info in the changelog
https://github.com/payloadcms/payload/blob/master/CHANGELOG.md- Collection slugs are no longer automatically sanitized to be kebab case. This will only be an issue if your current slugs were in camel case. The upgrade path will be to change those slugs to the kebab case version that the slug was automatically being sanitized to on the backend.
replaced the useAPIKey authentication header format to use the
- Collection slug instead of the collection label. Previous: ${collection.labels.singular} API-Key ${apiKey}, updated: ${collection.slug} API-Key ${apiKey}
thanks, in my case I was able to fix this by changing the config path to
dist/payload.config.ts
hey @jesschow I'm trying to update from 2.0.11 to 2.1.0 and getting a similar error on build:
[2023-11-10T11:46:14.893Z] #14 2.610 /home/node/app/node_modules/@swc/wasm/wasm.js:562
[2023-11-10T11:46:14.893Z] #14 2.610 const ret = new Error(getStringFromWasm0(arg0, arg1));
[2023-11-10T11:46:14.893Z] #14 2.610 ^
[2023-11-10T11:46:14.893Z] #14 2.610
[2023-11-10T11:46:14.893Z] #14 2.610 Error: unknown field `cwd`
[2023-11-10T11:46:14.893Z] #14 2.610 at module.exports.__wbindgen_error_new (/home/node/app/node_modules/@swc/wasm/wasm.js:562:17)
it builds and runs fine locally, but fails on CI and I didn't see any breaking changes in the releases in between these two versions. can you help me figure out what's wrong?
Hi @tais.m, that's correct there are no breaking changes between
v2.0.11
and
v2.1.0
. Is your project deployed on Payload Cloud or elsewhere?
A couple things to check / try:
1. Is your build command (in package.json) pointing to the payload config from your
dist
folder? That seemed to be the solution for @generator101
2. You could also try
npm i --no-save @swc/core
per this suggestion
https://discord.com/channels/967097582721572934/1111694244923580416/1118477235419107428the project is deployed in our own infra, but all other branches are building normally, just the one where I'm updating the version is having this issue. the update is currently blocked by the db adapter issue with documentdb anyway, so I haven't investigated further. once the new release comes out and we test that again I'll report back if the issue persists. thanks!
Oh right sounds good 👍
hey @jesschow, that seems to have solved it, but I'm still unclear on what the issue is and it's a bit hard to document why I've added
npm i --no-save @swc/core
to our build script. 😬 could this be solved by updating or fixing the version of
@swc/core
on the Payload side?
im having this issue, not specifically on Railawy but same
unknown field cwd
within a Dockerimage, after adding
npm i --no-save @swc/core
to it, it fixed it
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.