SAP/ui5-tooling

ui5 serve inside devcontainer unreachable from host

nocheintobi opened this issue · 5 comments

Expected Behavior

Accessing an app started via ui5 serve should be accessible from outside the devcontainer which properly exposes relevant port(s).

Current Behavior

When running a UI5 app via ui5 serve from within a DevContainer (in VSCode), I can cURL the index.html from inside the devcontainer. But when trying to access it from the host (outside the devcontainer), I do not get any response, all requests are pending like forever.

The container configuration is ok, when serving the app via the npm-module http-server, it is accessible from inside and outside the container as expected, only ui5 servedoes not work from outside.

The project itself is also ok, since when running it outside the devcvontainer, also everything works as expected - and I`m speaking of an "empty" generated example app.

Steps to Reproduce the Issue

  • Create a simple (TypeScript) UI5 app via `generator-easy-ui5``
  • add .devcontainer/devcontainer.jsonwith the following content:
{
    "image": "mcr.microsoft.com/devcontainers/typescript-node:20-bullseye",
    "forwardPorts": [8080, 35729]
}
  • open the project in VSCode DevContainer (Docker and VSCode-Extension Dev Containers required)
  • install dependencies (npm i)
  • build project (npm run build)
  • run project (npm start)
  • curl http://localhost:8080/index.html from inside the container (works fine)
  • Open http://localhost:8080/index.html in local browser (no result)

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 3.11.0
  • Node.js Version: 20.14.0
  • npm Version: 10.7.0
  • OS/Platform: Debian GNU/Linux 11 (bullseye) inside the container
  • OS/Platform of host: Tried macOS 14.5 as well as Windows 11
  • Browser (if relevant): any - tried Chrome, Brave, Safari, Edge and even cURL
  • Other information regarding your environment (optional): nothing

Log Output / Stack Trace

Unfortunately, there is no log entry when requesting and no client side error or response.

Hi @nocheintobi, thanks a lot for sharing this finding. We will analyze your issue/requirement.

Please try using ui5 serve --accept-remote-connections

https://sap.github.io/ui5-tooling/v3/pages/CLI/#ui5-serve

I added the flag - and as you can see in the screenshot, it has been accepted - but unfortunately still no access from outside the container.
screenshot

Hi @nocheintobi ,

Did you try to rebuild the container?
It seems like the port forwarding didn't work on your side.
I just tried this scenario with https://github.com/SAP/openui5-sample-app and it works perfectly fine. Even without the flag @RandomByte proposed above.

You can also check the port bindings of your running containers in running the Docker container

Cheers

Ok, now I'm confused...
In fact, I rebuilt the container several times before without any effects. And we had the issue on two completely different hosts independently (a mac and a win machine)...
BUT: the sample app @d3xter666 mentioned worked fine (not without the flag mentioned by @RandomByte, but that makes kind of sense).
I deleted all related containers and images and retried with our demo app and an additional productive app => now both are working on my host as desired.
I'll follow up in case the other computer gives additional information on the cause - thanks a lot for your support!