nx-forge icon indicating copy to clipboard operation
nx-forge copied to clipboard

Serve (tunnel) executor throws a TypeError on forge project that doesn't have any custom UI

Open zjkipping opened this issue 5 months ago • 2 comments

I have found that the nx serve forge-app doesn't seem to work on forge apps that don't have a custom UI attached to it.

I ran the below command to generate an ESBuild forge app: npx nx g @toolsplus/nx-forge:app my-forge-app --directory=my-forge-app --bundler=esbuild --projectNameAndRootFormat=as-provided

After doing the whole package & register setup, I try to run npx nx serve my-forge-app and it fails with the below errors logs:

Wait for all Custom UI 'serve' targets to have started and servers are listening...
All Custom UI 'serve' targets have started and servers are listening
Running: forge tunnel --verbose
Failed to tunnel Forge app: TypeError: Cannot read properties of undefined (reading 'next')
 NX   Cannot read properties of undefined (reading 'next')

This is on node v20.x and Forge CLI version 10.5.0.

I have tried the same npx nx serve command with an ESBuild forge app that has a custom UI attached to it using the resourceOutputPathMap project.json package property and it works just fine.

:WORKAROUND: I have had some success of doing the below workaround:

  1. npx nx package my-forge-app
  2. npx nx build my-forge-app --watch
  3. cd into the dist of my-forge-app and run npx forge tunnel.

zjkipping avatar Sep 19 '24 20:09 zjkipping