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

[ui5-middleware-simpleproxy] usage of deprecated _headers call from express-proxy #816

Closed
MoritzSchleySAP opened this issue Aug 29, 2023 · 1 comment · Fixed by #818
Closed

Comments

@MoritzSchleySAP
Copy link

Describe the bug
Using the ui5-middleware-simpleproxy to connect to another backend system (in this case a SpringBoot system) leads to warnings related to a deprecated function/variable call.

(node:30408) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated (Use node --trace-deprecation ... to show where the warning was created)

Tracing the error using --trace-deprecation leads to the express-http-proxy package which is used as a basis for ui5-middleware-simpleproxy:

DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
    at clearAllHeaders (node_modules\express-http-proxy\app\steps\decorateUserResHeaders.js:13:30)
    at node_modules\express-http-proxy\app\steps\decorateUserResHeaders.js:22:9
    at new Promise (<anonymous>)
    atnode_modules\express-http-proxy\app\steps\decorateUserResHeaders.js:21:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

While this looks like a problem with express-http-proxy at first, the issue itself has been solved in 2019, which is why I'm irritated that the warning still shows as of today.

Steps to reproduce the behavior

  1. Create a new UI5 Project (EasyUI5-Generator)
  2. Install ui5-middleware-simpleproxy
  3. Set mountPath and baseUri to the additional backend (e.g. "/backend" and "http://localhost:8081")
  4. Create a simple get request in frontend and backend (e.g. using a button and XMLHTTPRequest)
  5. Execute it with proxy path and original URL

Project configuration

UI5.yaml:

specVersion: "3.0"
metadata:
  name: sap.m.example
type: application
framework:
  name: SAPUI5
  version: "1.117.1"
  libraries:
    - name: sap.m
    - name: sap.ui.core
    - name: themelib_sap_horizon
builder:
  customTasks:
    - name: ui5-tooling-modules-task
      afterTask: replaceVersion
      configuration:
        addToNamespace: true
    - name: ui5-tooling-transpile-task
      afterTask: replaceVersion
      configuration:
        transformAsyncToPromise: true
server:
  customMiddleware:
    - name: ui5-tooling-modules-middleware
      afterMiddleware: compression
    - name: ui5-tooling-transpile-middleware
      afterMiddleware: compression
      configuration:
        transformAsyncToPromise: true
    - name: ui5-middleware-livereload
      afterMiddleware: compression
    - name: ui5-middleware-simpleproxy
      afterMiddleware: compression
      mountPath: /backend
      configuration:
        baseUri: "http://localhost:8081"
    - name : ui5-middleware-index
      afterMiddleware: compression
      configuration:
        index: "index.html"

Package.json

{
	"name": "sap.m.example",
	"version": "1.0.0",
	"description": "Example for Github",
	"author": "Moritz Schley",
	"license": "Apache-2.0",
	"scripts": {
		"start": "npm-run-all -p start-frontend start-backend",
		"start-frontend": "ui5 serve --port 8080 -o",
		"start-backend": "mvnw spring-boot:run",
		"ts-typecheck": "tsc --noEmit",
		"lint": "eslint webapp"
	},
	"devDependencies": {
		"@sapui5/types": "1.117.1",
		"@types/plotly.js-dist-min": "^2.3.1",
		"@typescript-eslint/eslint-plugin": "^6.2.0",
		"@typescript-eslint/parser": "^6.2.0",
		"@ui5/cli": "^3.3.4",
		"eslint": "^8.46.0",
		"karma": "^6.4.2",
		"karma-chrome-launcher": "^3.2.0",
		"karma-coverage": "^2.2.1",
		"karma-ui5": "^3.0.3",
		"karma-ui5-transpile": "^3.0.0",
		"npm-run-all": "^4.1.5",
		"plotly.js-dist-min": "^2.25.2",
		"rimraf": "^5.0.1",
		"typescript": "^5.1.6",
		"ui5-middleware-index": "^3.0.0",
		"ui5-middleware-livereload": "^3.0.0",
		"ui5-middleware-simpleproxy": "^3.0.0",
		"ui5-tooling-modules": "^3.0.4",
		"ui5-tooling-transpile": "^3.0.0"
	}
}

Additional Information
[email protected]
node v18.17.0

petermuessig added a commit that referenced this issue Aug 31, 2023
The `ui5-middleware-cfdestination` and `ui5-middleware-simpleproxy`
are now using the `http-proxy-middleware` instead of the former
`express-http-proxy` to support the following features:

* Support for corporate proxy using env variables (see more details
https://www.npmjs.com/package/proxy-from-env#environment-variables)
* Support redirects using the `autoRewrite` option to handle UAA
* Preparation for websocket support to be able to proxy websocket
requrests (#557)
* Get rid of deprecated `_headers` call due to `express-http-proxy`
* Improved test-cases for the `cfdestination` middleware
* Added test-cases for the `simpleproxy` middleware
* Script to generate self-signed certificates automatically added

Fixes #748 - corporate proxy issue
Fixes #817 - UAA issues
Fixes #816 - deprecated `_headers` call
petermuessig added a commit that referenced this issue Aug 31, 2023
The `ui5-middleware-cfdestination` and `ui5-middleware-simpleproxy`
are now using the `http-proxy-middleware` instead of the former
`express-http-proxy` to support the following features:

* Support for corporate proxy using env variables (see more details
https://www.npmjs.com/package/proxy-from-env#environment-variables)
* Support redirects using the `autoRewrite` option to handle UAA
* Preparation for websocket support to be able to proxy websocket
requrests (#557)
* Get rid of deprecated `_headers` call due to `express-http-proxy`
* Improved test-cases for the `cfdestination` middleware
* Added test-cases for the `simpleproxy` middleware
* Script to generate self-signed certificates automatically added

Fixes #748 - corporate proxy issue
Fixes #817 - UAA issues
Fixes #816 - deprecated `_headers` call
petermuessig added a commit that referenced this issue Aug 31, 2023
The `ui5-middleware-cfdestination` and `ui5-middleware-simpleproxy`
are now using the `http-proxy-middleware` instead of the former
`express-http-proxy` to support the following features:

* Support for corporate proxy using env variables (see more details
https://www.npmjs.com/package/proxy-from-env#environment-variables)
* Support redirects using the `autoRewrite` option to handle UAA
* Preparation for websocket support to be able to proxy websocket
requrests (#557)
* Get rid of deprecated `_headers` call due to `express-http-proxy`
* Improved test-cases for the `cfdestination` middleware
* Added test-cases for the `simpleproxy` middleware
* Script to generate self-signed certificates automatically added

Fixes #748 - corporate proxy issue
Fixes #817 - UAA issues
Fixes #816 - deprecated `_headers` call
petermuessig added a commit that referenced this issue Aug 31, 2023
The `ui5-middleware-cfdestination` and `ui5-middleware-simpleproxy`
are now using the `http-proxy-middleware` instead of the former
`express-http-proxy` to support the following features:

* Support for corporate proxy using env variables (see more details
https://www.npmjs.com/package/proxy-from-env#environment-variables)
* Support redirects using the `autoRewrite` option to handle UAA
* Preparation for websocket support to be able to proxy websocket
requrests (#557)
* Get rid of deprecated `_headers` call due to `express-http-proxy`
* Improved test-cases for the `cfdestination` middleware
* Added test-cases for the `simpleproxy` middleware
* Script to generate self-signed certificates automatically added

Fixes #748 - corporate proxy issue
Fixes #817 - UAA issues
Fixes #816 - deprecated `_headers` call
@petermuessig
Copy link
Member

Should be fixed with ui5-middleware-simpleproxy version 3.1.0 which will be released just right now!

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 a pull request may close this issue.

2 participants