Github Actions - Error: can't find the configuration file located at ${rawConfigPath}.

default discord avatar
sam6466
4 months ago
9

I am attempting to build the admin panel in a Github Action using

payload build

. It works fine locally, but when running in the Github Action runner, I get the following error:



 Caused by:
    unknown field `cwd` at line 1 column 3195
/home/runner/work/{{repo_name}}/{{repo_name}}/node_modules/payload/dist/bin/build.js:35
        throw new Error(`Error: can't find the configuration file located at ${rawConfigPath}.`);

Error: Error: can't find the configuration file located at /home/runner/work/{{repo_name}}/{{repo_name}}/apps/cms/src/payload.config.ts.


Despite it saying that it can't find the config file, it does appear to be looking in the correct place. I've seen some other threads here where it was throwing the same error, but the error was in fact caused by something entirely different.

  • discord user avatar
    jmikrut
    Payload Team
    4 months ago

    yes i wouldn't trust that error



    i actually added a fix to our roadmap to clarify error messages that come from the admin build process earlier today



    i dont know why this would be, but maybe Github Actions don't allow the use of

    process.cwd

    ?

  • default discord avatar
    sam6466
    3 months ago

    I'm at a bit of a loss on how to debug this one. The error output isn't very descriptive so I'm not sure which file or dependency is throwing it. The post was for 1.8.2, and I upgraded to 1.8.5. The only thing that changed was the column number



    unknown field `cwd` at line 1 column 4148


    Going to make sure it's not something in my specific setup by trying a fresh version of payload



    I found the problem. I grepped the error message to find out where that string originated from and it was in an SWC .node binary file.



    I'm running payload in an NX monorepo and had the following dependency:


    "@swc/core": "~1.3.51"

    After upgrading it to the latest 1.3.62, it successfully ran in the github actions runner



    I suppose there was a bug in that version

  • discord user avatar
    jmikrut
    Payload Team
    3 months ago

    Woah!



    Nice work!! Thanks for reporting the fix that you found as well

  • default discord avatar
    richadr
    3 months ago

    just to add this for people landing through search, I traced it down to this specific issue


    https://github.com/swc-project/swc/issues/5616#issuecomment-1551706075

    for me, it would run fine locally but fail in GitHub Actions. i updated pipeline and added this hack after

    npm ci

    :


    npm i --no-save @swc/core
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.