nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.22k stars 2.31k forks source link

Nx Cloud Error (it seems) during the GH Actions Workflow #21905

Open alexandr2110pro opened 6 months ago

alexandr2110pro commented 6 months ago

Current Behavior

When running our CD workflow on the GH Actions with enabled Nx Cloud Caching (Nx Replay) we see the following in the logs:

... more logs ...

[NX CLOUD] Verifying current cloud bundle
[NX CLOUD] A local bundle currently exists:  {
  version: '2402.08.4',
  fullPath: '/home/runner/work/<redacted>/<redacted>/.nx/cache/cloud/2402.08.4'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Done:  /home/runner/work/<redacted>/<redacted>/.nx/cache/cloud/2402.08.4
  ERROR  failed to read input source map: failed to parse inline source map url
",u=a.length,l=(0,pr.basename)(e),f=(0,pr.extname)(e),p=n(e),g=l.slice(0,-f.length)+p+".map",E=u+g.length;if(t.substr(-E,u)===a)return t.slice(0,-E)+o;let y=u+encodeURI(g).length;return t.substr(-y,u)===a?t.slice(0,-y)+o:`${t}
Caused by:
    relative URL without a base
    at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.0/src/lib.rs:[38](https://github.com/<redacted>/<redacted>/actions/runs/7984859333/job/21802360408#step:10:39)5
 >  NX   Trying to create heartbeat background process for run group: 798[48](https://github.com/<redacted>/<redacted>/actions/runs/7984859333/job/21802360408#step:10:49)59333-1
 >  NX   Heartbeat process started successfully with PID 2070
 >  NX   Running target cdk-deploy-needs for 3 projects and 5 tasks they depend on:

... more logs ...

We are not sure what that is.

The workflow is able to continue and complete what it is supposed to do, despite the error in the logs.

Expected Behavior

I'm not sure, but I guess there are no errors in the logs.

GitHub Repo

private

Steps to Reproduce

  1. Create the integrated nx repo
  2. Connect to nx cloud
  3. Setup the GitHub actions workflow
  4. Run the workflow
  5. See the logs with debug mode in gh actions

Nx Report

This is from local machine:

   Node   : 20.11.0
   OS     : darwin-x64
   pnpm   : 8.15.1

   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/esbuild        : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/next           : 17.2.8
   @nx/node           : 17.2.8
   @nx/playwright     : 17.2.8
   @nx/plugin         : 17.2.8
   @nx/react          : 17.2.8
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   @nx-tools/nx-container : 5.2.0
   ---------------------------------------
   Local workspace plugins:
         @app/docker
         @app/next
         @app/aws
         @app/cdk

Failure Logs

...

[NX CLOUD] Verifying current cloud bundle
[NX CLOUD] A local bundle currently exists:  {
  version: '2402.08.4',
  fullPath: '/home/runner/work/<redacted>/<redacted>/.nx/cache/cloud/2402.08.4'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Done:  /home/runner/work/<redacted>/<redacted>/.nx/cache/cloud/2402.08.4
  ERROR  failed to read input source map: failed to parse inline source map url
",u=a.length,l=(0,pr.basename)(e),f=(0,pr.extname)(e),p=n(e),g=l.slice(0,-f.length)+p+".map",E=u+g.length;if(t.substr(-E,u)===a)return t.slice(0,-E)+o;let y=u+encodeURI(g).length;return t.substr(-y,u)===a?t.slice(0,-y)+o:`${t}
Caused by:
    relative URL without a base
    at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.0/src/lib.rs:385
 >  NX   Trying to create heartbeat background process for run group: 7984859333-1
 >  NX   Heartbeat process started successfully with PID 6299
 >  NX   Running target cdk-deploy for 3 projects and 5 tasks they depend on:

...

Package Manager Version

pnpm@8.15.1

Operating System

Additional Information

Sorry for no reproduction repo. I might find a minute to create one later.

NachoVazquez commented 6 months ago

I'm hitting something similar, even locally, but only with the build command

nx run-many -t build --skip-nx-cache
  ERROR  failed to read input source map: failed to parse inline source map url
",u=a.length,l=(0,pr.basename)(e),f=(0,pr.extname)(e),p=n(e),g=l.slice(0,-f.length)+p+".map",E=u+g.length;if(t.substr(-E,u)===a)return t.slice(0,-E)+o;let y=u+encodeURI(g).length;return t.substr(-y,u)===a?t.slice(0,-y)+o:`${t}

Caused by:
    relative URL without a base
    at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.272.4/src/lib.rs:385
masonmark commented 6 months ago

We are seeing the same thing, locally and in CI, when building or serving any Angular app it seems (even just a trivial one generated for testing). I'm using Nx 18.0.6 currently but I think the problem maybe started when we upgraded to 18.

➜  ucm5 git:(mason-test) ✗ npx nx run demo-app-angular:build:developement
  ERROR  failed to read input source map: failed to parse inline source map url
",u=a.length,l=(0,dr.basename)(e),f=(0,dr.extname)(e),p=n(e),y=l.slice(0,-f.length)+p+".map",E=u+y.length;if(t.substr(-E,u)===a)return t.slice(0,-E)+o;let g=u+encodeURI(y).length;return t.substr(-g,u)===a?t.slice(0,-g)+o:`${t}

Caused by:
    relative URL without a base
    at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.269.16/src/lib.rs:385

  ✔    1/1 dependent project tasks succeeded [0 read from cache]

  Hint: you can run the command with --verbose to see the full dependent project outputs

...or, for serve:

➜  ucm5 git:(mason-test) ✗ npx nx run demo-app-angular:serve:developement
  ERROR  failed to read input source map: failed to parse inline source map url
",u=a.length,l=(0,dr.basename)(e),f=(0,dr.extname)(e),p=n(e),y=l.slice(0,-f.length)+p+".map",E=u+y.length;if(t.substr(-E,u)===a)return t.slice(0,-E)+o;let g=u+encodeURI(y).length;return t.substr(-g,u)===a?t.slice(0,-g)+o:`${t}

Caused by:
    relative URL without a base
    at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.269.16/src/lib.rs:385

 NX   Running target serve for project demo-app-angular and 1 task it depends on:

... the build continues and apparently works, though, so perhaps this error isn't important but just scary looking?

I think the error is coming from swc, our swc dependencies are as follows:

    "@swc-node/core": "^1.9.0",
    "@swc-node/register": "1.8.0",
    "@swc/cli": "~0.1.62",
    "@swc/core": "1.3.95",
    "@swc/wasm": "^1.3.92",
alexandr2110pro commented 6 months ago

Does anybody know what is the impact of this error? At a glance, all works well despite the error in the console.

masonmark commented 6 months ago

I don't know for sure but I suspect it is just a scary warning that is a non-critical problem under the hood. This error appears for any build/serve operation for any app in our monorepo, but they are all passing their tests and I have not detected any misbehavior. So we are ignoring it for now. (But, I have gotten questions from other engineers like "uh oh, I am seeing this new error, how can I fix this?" so hopefully it will be fixed soon...)

nacho-vazquez commented 6 months ago

For me, it does not work. It makes the CI fail. I had to opt out of Nx Cloud.

alexandr2110pro commented 6 months ago

@masonmark same here.

@nacho-vazquez what does it say in the end if you enable both debug logging on gh actions and --verbose in nx?

nacho-vazquez commented 6 months ago

I'll come back to you with that.

PowerSupply commented 6 months ago

Same problem here locally and on CI (Jenkins) since I upgrading to Nx 18.

Using Mac OS

sidyes commented 6 months ago

Same problem here, too. Happening on both Mac OS and Windows (and within a Github Workflow).

heathprovost commented 5 months ago

Same. Windows inside of WSL Ubuntu when running local builds.

just-be-weird commented 5 months ago

I'm getting the exact error, not sure what is the root cuase of this

 nx run gateway:build:production
  ERROR  failed to read input source map: failed to parse inline source map url
",c=a.length,u=(0,Fn.basename)(e),p=(0,Fn.extname)(e),f=r(e),h=u.slice(0,-p.length)+f+".map",g=c+h.length;if(t.substr(-g,c)===a)return t.slice(0,-g)+s;let b=c+encodeURI(h).length;return t.substr(-b,c)===a?t.slice(0,-b)+s:`${t}

Caused by:
    relative URL without a base
    at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.273.17/src/lib.rs:385
jyannessa-mtx commented 5 months ago

Getting this error after creating a custom executor to serve dependent apps. Still able to run other nx commands without issue.

macOS 14.2.1 M1 Max NX 18.0.4

nx serve-detached example-nest
ERROR  failed to read input source map: failed to parse inline source map url
",c=a.length,u=(0,Fn.basename)(e),p=(0,Fn.extname)(e),f=r(e),h=u.slice(0,-p.length)+f+".map",g=c+h.length;if(t.substr(-g,c)===a)return t.slice(0,-g)+s;let b=c+encodeURI(h).length;return t.substr(-b,c)===a?t.slice(0,-b)+s:`${t}

Caused by:
    relative URL without a base
    at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc-0.266.36/src/lib.rs:384
JacobGardos commented 5 months ago

I manage to fix this error

ERROR failed to read input source map: failed to parse inline source map url

By simply installing nx-cloud as a dependency.

npm install nx-cloud

I've tested it on Windows 11 and WSL via devcontainers and the problem seems to be fixed.

Here is a link to a basic working repository using a local plugin & executor: https://github.com/JacobGardos/nx-swc-fix (See README.md for instructions)

Let me know if this helps.


For a more detailed explanation in regards to the cause of the error check out this comment from a similar issue.

https://github.com/nrwl/nx/issues/22146#issuecomment-2028904256


Nx Report For Windows 11 & WSL

Node   : 20.11.1
OS     : win32-x64
npm    : 10.2.4

nx (global)        : 18.2.1
nx                 : 18.2.1
@nx/js             : 18.2.1
@nx/jest           : 18.2.1
@nx/linter         : 18.2.1
@nx/eslint         : 18.2.1
@nx/workspace      : 18.2.1
@nx/devkit         : 18.2.1
@nx/eslint-plugin  : 18.2.1
@nx/nest           : 18.2.1
@nx/node           : 18.2.1
@nx/plugin         : 18.2.1
@nrwl/tao          : 18.2.1
@nx/web            : 18.2.1
@nx/webpack        : 18.2.1
nx-cloud           : 18.0.0
typescript         : 5.4.3
---------------------------------------
Local workspace plugins:
         @org/my-plugin
Node   : 20.11.1
OS     : linux-x64
npm    : 10.2.4

nx (global)        : 18.2.1
nx                 : 18.2.1
@nx/js             : 18.2.1
@nx/jest           : 18.2.1
@nx/linter         : 18.2.1
@nx/eslint         : 18.2.1
@nx/workspace      : 18.2.1
@nx/devkit         : 18.2.1
@nx/eslint-plugin  : 18.2.1
@nx/nest           : 18.2.1
@nx/node           : 18.2.1
@nx/plugin         : 18.2.1
@nrwl/tao          : 18.2.1
@nx/vite           : 18.2.1
@nx/vue            : 18.2.1
@nx/web            : 18.2.1
@nx/webpack        : 18.2.1
typescript         : 5.4.3
---------------------------------------
Local workspace plugins:
         @org/nuxt
heathprovost commented 5 months ago

I manage to fix this error

ERROR failed to read input source map: failed to parse inline source map url

By simply installing nx-cloud as a dependency.


npm install nx-cloud

THANK YOU!

joshcalafell commented 5 months ago

@heathprovost thanks. This helped with the same problem with my TypeScript/NativeScript/Angular17 monorepo executor on MacOS Sonoma 14.4.1 :) Cheers!