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

@uppy/companion: remove dependency on express-request-id #5176

Merged
merged 2 commits into from
May 16, 2024

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented May 16, 2024

That module is not doing anything special, IMO using it puts more maintenance burden on us than implementing it ourselves.

Copy link

socket-security bot commented May 16, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/fs-constants@1.0.0 filesystem 0 2.22 kB mafintosh

🚮 Removed packages: npm/flow-parser@0.236.0, npm/postcss-safe-parser@6.0.0

View full report↗︎

Copy link
Contributor

Diff output files
diff --git a/packages/@uppy/companion/lib/standalone/index.js b/packages/@uppy/companion/lib/standalone/index.js
index db83631..71517a9 100644
--- a/packages/@uppy/companion/lib/standalone/index.js
+++ b/packages/@uppy/companion/lib/standalone/index.js
@@ -2,11 +2,11 @@
 Object.defineProperty(exports, "__esModule", { value: true });
 const express = require("express");
 const qs = require("node:querystring");
+const { randomUUID } = require("node:crypto");
 const helmet = require("helmet");
 const morgan = require("morgan");
 const { URL } = require("node:url");
 const session = require("express-session");
-const addRequestId = require("express-request-id")();
 const RedisStore = require("connect-redis").default;
 const logger = require("../server/logger");
 const redis = require("../server/redis");
@@ -67,7 +67,12 @@ module.exports = function server(inputCompanionOptions) {
     });
     return { query, censored };
   }
-  router.use(addRequestId);
+  router.use((request, response, next) => {
+    const headerName = "X-Request-Id";
+    const oldValue = request.get(headerName);
+    response.set(headerName, oldValue ?? randomUUID());
+    next();
+  });
   // log server requests.
   router.use(morgan("combined"));
   morgan.token("url", (req) => {

@aduh95 aduh95 merged commit 5d5dab1 into 4.x May 16, 2024
21 checks passed
@aduh95 aduh95 deleted the bump-companion-deps branch May 16, 2024 11:54
Murderlon added a commit that referenced this pull request May 21, 2024
* 4.x: (24 commits)
  @uppy/companion: encode `uploadId` (#5168)
  @uppy/companion: bump `express-session` (#5177)
  @uppy/companion: remove dependency on `express-request-id` (#5176)
  @uppy/companion: bump prom to v15 (#5175)
  docs: fix linter
  meta: remove `nodemon` from the deps (#5172)
  docs: update `@uppy/aws-s3` docs (#5093)
  meta: update more dependencies (#5171)
  @uppy/companion: upgrade deps (#5119)
  Release: uppy@4.0.0-beta.7 (#5162)
  @uppy/companion: switch from `node-redis` to `ioredis` (#4623)
  Fix headings in xhr.mdx
  @uppy/xhr-upload: introduce hooks similar to tus (#5094)
  @uppy/core: close->destroy, clearUploadedFiles->clear (#5154)
  Use `title` consistently from locales (#5134)
  Release: uppy@4.0.0-beta.6 (#5152)
  Release: uppy@4.0.0-beta.5 (#5141)
  meta: run Prettier in the release workflow
  Release: uppy@3.25.1 (#5139)
  Bump ejs from 3.1.9 to 3.1.10 (#5135)
  ...
github-actions bot added a commit that referenced this pull request May 22, 2024
| Package              |      Version | Package              |      Version |
| -------------------- | ------------ | -------------------- | ------------ |
| @uppy/aws-s3         | 4.0.0-beta.4 | @uppy/status-bar     | 4.0.0-beta.8 |
| @uppy/companion      | 5.0.0-beta.7 | @uppy/svelte         | 4.0.0-beta.4 |
| @uppy/compressor     | 2.0.0-beta.8 | @uppy/tus            | 4.0.0-beta.5 |
| @uppy/core           | 4.0.0-beta.8 | @uppy/utils          | 6.0.0-beta.7 |
| @uppy/dashboard      | 4.0.0-beta.8 | @uppy/vue            | 2.0.0-beta.3 |
| @uppy/image-editor   | 3.0.0-beta.5 | @uppy/webcam         | 4.0.0-beta.7 |
| @uppy/provider-views | 4.0.0-beta.6 | uppy                 | 4.0.0-beta.8 |

- @uppy/core: resolve some (breaking) TODOs (Antoine du Hamel / #4824)
- @uppy/companion: encode `uploadId` (Mikael Finstad / #5168)
- @uppy/companion: bump `express-session` (Antoine du Hamel / #5177)
- @uppy/companion: remove dependency on `express-request-id` (Antoine du Hamel / #5176)
- @uppy/companion: bump prom to v15 (Antoine du Hamel / #5175)
- docs: fix linter (Antoine du Hamel)
- meta: remove `nodemon` from the deps (Antoine du Hamel / #5172)
- docs: update `@uppy/aws-s3` docs (Antoine du Hamel / #5093)
- meta: update more dependencies (Antoine du Hamel / #5171)
- @uppy/companion: upgrade deps (Antoine du Hamel / #5119)
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.

1 participant