ui5-community / ui5-ecosystem-showcase

A repository showcasing the UI5 tooling extensibility to combine OSS tools for UI5 application development.
https://ui5-community.github.io/ui5-ecosystem-showcase/
Other
189 stars 91 forks source link

[ui5-middleware-ui5] Not working with server option --h2 #916

Open faow opened 7 months ago

faow commented 7 months ago

Describe the bug If you add the parameter --h2 to the server, the path is not mounted.

my.test.app@1.0.0 start
ui5 serve

info graph:projectGraphBuilder Excluding additional application project my.test.tsapp from graph. The project graph can only feature a single project of type application. Project my.test.app has already qualified for that role.
info graph:helpers:ui5Framework Using OpenUI5 version: 1.118.0
info server:custom-middleware:ui5-middleware-livereload Livereload server started!
info server:custom-middleware:ui5-middleware-ui5 Mounting /resources/my/test/tsapp to UI5 app XXX\showcase-ui5-middleware-ui5-main\packages\my.test.tsapp (id=my.test.tsapp)
Server started
URL: http://localhost:8080
info graph:helpers:ui5Framework Using OpenUI5 version: 1.118.0
info server:custom-middleware:ui5-middleware-livereload Livereload server started!
> my.test.app@1.0.0 start
> ui5 serve --h2

info graph:projectGraphBuilder Excluding additional application project my.test.tsapp from graph. The project graph can only feature a single project of type application. Project my.test.app has already qualified for that role.
info graph:helpers:ui5Framework Using OpenUI5 version: 1.118.0
info server:custom-middleware:ui5-middleware-livereload Livereload server started!
(node:32052) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Server started
URL: https://localhost:8443

To Reproduce Steps to reproduce the behavior:

  1. Go to https://github.com/petermuessig/showcase-ui5-middleware-ui5
  2. Add parameter --h2 to the start script
  3. See error
petermuessig commented 7 months ago

Thx @faow for the issue, I'll take a look once I have a bit of free time...

petermuessig commented 7 months ago

@faow - short update - the problem is the way how we hook into the express application and in case of https is being used, the original express app is wrapped into a spdy app for which the listen call isn't overridden. I'm not sure yet whether this can work at all, as there is no real possibility to intercept the spdy listen call from outside... 😢

faow commented 7 months ago

@petermuessig Thanks for letting me know. Since https is not a fixed requirement for us, I will switch to http for the time being and hope that someone might have an idea in the future.

petermuessig commented 7 months ago

@faow - ok, good to know - I'm still looking into the topic - currently searching for the best possible way to retrieve the necessary information when the UI5 tooling is putting spdy around the express server. To be able to hook into the express application I need to get access to the app and the server and I now need to revalidate how this could be achieved with spdy. It's a bit tricky and I require some more think time for that...

petermuessig commented 6 months ago

There seems to be no possibility to overcome that issue. The following lines in the UI5 tooling override the express app with the spdy app and thus the listen callback isn't invoked anymore:

https://github.com/SAP/ui5-server/blob/main/lib/server.js#L180-L182

IMO, the only way to support this development middleware also for https is that the UI5 tooling exposes the server. I need to follow up on this with @RandomByte and @matz3

petermuessig commented 1 month ago

@RandomByte @matz3 - is it possible to provide access to the server with the next major upgrade of the UI5 tooling for the h2 case?

RandomByte commented 1 month ago

We hope to implement the "component type" in UI5 Tooling sometime soon which should hopefully make this middleware obsolete: https://github.com/SAP/ui5-tooling/issues/45

In general, we would like to provide specific APIs for custom middleware to achieve what they want. By exposing the underlying server instance we loose control over which middleware is handling which request and can't guarantee compatibility anymore. So let's rather try and discuss whether we can solve such use cases through specific API provided by ui5-server 👍