@middy/rds-signer 7.5.0 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -1
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -70,6 +70,12 @@ const rdsSignerMiddleware = (opts = {}) => {
70
70
  };
71
71
  for (const key of Object.keys(options.fetchData)) {
72
72
  options.fetchData[key] = { ...defaultFetchData, ...options.fetchData[key] };
73
+ if (!options.fetchData[key].hostname) {
74
+ throw new Error(
75
+ `fetchData.${key}.hostname is required; set PGHOST, DBHOST, or pass hostname explicitly`,
76
+ { cause: { package: pkg } },
77
+ );
78
+ }
73
79
  }
74
80
 
75
81
  const fetchDataKeys = Object.keys(options.fetchData);
@@ -88,7 +94,9 @@ const rdsSignerMiddleware = (opts = {}) => {
88
94
  values[internalKey] = clients[internalKey]
89
95
  [method]()
90
96
  .then((token) => {
91
- // Catch Missing token, this usually means there is something wrong with the credentials
97
+ // Pre-signed token URLs always include X-Amz-Security-Token when temporary
98
+ // credentials (IAM role) are used, which is always the case in Lambda.
99
+ // A missing token usually indicates a credential or signing problem.
92
100
  if (!token.includes("X-Amz-Security-Token=")) {
93
101
  throw new Error("X-Amz-Security-Token Missing", {
94
102
  cause: { package: pkg, method },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/rds-signer",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "description": "RDS (Relational Database Service) credentials middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -70,11 +70,11 @@
70
70
  }
71
71
  },
72
72
  "dependencies": {
73
- "@middy/util": "7.5.0"
73
+ "@middy/util": "7.6.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@aws-sdk/rds-signer": "^3.0.0",
77
- "@middy/core": "7.5.0",
77
+ "@middy/core": "7.6.0",
78
78
  "@types/aws-lambda": "^8.0.0",
79
79
  "@types/node": "^22.0.0",
80
80
  "aws-xray-sdk": "^3.3.3"