Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

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

default discord avatar
sam6466last year
5

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
    last year

    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
    sam6466last year

    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
    last year

    Woah!



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

  • default discord avatar
    richadrlast year

    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
  • default discord avatar
    wkd1079last year

    thank you OP, i hit a similar issue yesterday and had been totally stumped. commands also work fine locally, and in docker, but choke in GH actions (and using

    act

    to test actions locally). the error message also made me wonder if my monorepo architecture was a contributing factor... 🤔



    like many other commenters in the swc thread, I sidestepped the issue by using

    pnpm

    for this specific command, rather than

    npm

    which I use everywhere else. not ideal but it works.



    unlike OP, I do not have a direct

    swc

    dependency that I can adjust to fix the issue. instead, i'm relying on payload's, which I noticed are deprecated:

    https://github.com/payloadcms/payload/blob/b8cd1c6ba44cda2baa9b08fea09e69580ebe7a1a/package.json#L42-L44

    I wonder if migrating from

    @swc/*

    to

    @swc-node/*

    would fix this for good. i will do some more testing and open a PR when i have a chance!

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.