Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-proxy-middleware): support usage inside connect servers #1224

Merged
merged 4 commits into from
Aug 28, 2023

Conversation

petermuessig
Copy link
Contributor

When using the dev-approuter (https://www.npmjs.com/package/dev-approuter) to run UI5 and CAP applications inside the @sap/router from a monorepo then the server is using connect and not express. In those scenarios, similar like with livereload only the basic http response object from Node.js is available and the status function is not available which leads to an INTERNAL SERVER ERROR. By using the writeHead, write and end function of the response object the function is agnostic to the used server and works in both scenarios.

@petermuessig petermuessig requested a review from a team as a code owner August 27, 2023 20:04
@changeset-bot
Copy link

changeset-bot bot commented Aug 27, 2023

🦋 Changeset detected

Latest commit: 6e4134a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sap-ux/ui5-proxy-middleware Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cla-assistant
Copy link

cla-assistant bot commented Aug 27, 2023

CLA assistant check
All committers have signed the CLA.

@petermuessig
Copy link
Contributor Author

petermuessig commented Aug 27, 2023

Hi @zdravko-georgiev ,

please get in touch with @nicoschoenteich - he has the project setup for this new dev-approuter with which you can also validate the fix. I tested it locally by manually fixing it in the node_modules.

BTW: when you search for res.status in this repo, you can find additional places which may have issues in such connect scenarios: adp-tooling, preview-middleware. They are not required to be fixed for now - but just FYI. It would be great to get this one fixed, so that the proxy-middleware can be used with the dev-approuter.

Thanks a lot... 😄

When using the dev-approuter (https://www.npmjs.com/package/dev-approuter)
to run UI5 and CAP applications inside the @sap/router from a monorepo
then the server is using connect and not express. In those scenarios, similar
like with livereload only the basic http response object from Node.js is
available and the status function is not available which leads to an
INTERNAL SERVER ERROR. By using the writeHead, write and end function of
the response object the function is agnostic to the used server and works
in both scenarios.
@petermuessig petermuessig force-pushed the fix/ProxyMiddlewareForConnect branch from 9183d96 to cfd5246 Compare August 27, 2023 20:32
Copy link
Contributor

@tobiasqueck tobiasqueck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • code changes look good on first glance, just added a question
  • changeset is missing
  • didn't test locally the old or the new scenario

Copy link
Contributor

@zdravko-georgiev zdravko-georgiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes looks good
Excellent test coverage
Didn't tested locally

Thanks @petermuessig

Copy link
Contributor

@tobiasqueck tobiasqueck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing changeset was added and my questions answered since my last review

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@zdravko-georgiev zdravko-georgiev merged commit bce98f8 into main Aug 28, 2023
@zdravko-georgiev zdravko-georgiev deleted the fix/ProxyMiddlewareForConnect branch August 28, 2023 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants