@vercel/functions 3.10.2 → 3.10.4

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @vercel/functions
2
2
 
3
+ ## 3.10.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 4db77ba: Fix `ipAddress` throwing for header readers with an internal `headers` property, such as the Next.js headers adapter.
8
+ - @vercel/oidc@4.0.4
9
+
10
+ ## 3.10.3
11
+
12
+ ### Patch Changes
13
+
14
+ - @vercel/oidc@4.0.3
15
+
3
16
  ## 3.10.2
4
17
 
5
18
  ### Patch Changes
@@ -6,7 +6,7 @@
6
6
 
7
7
  > **geolocation**(`request`): [`Geo`](../interfaces/Geo.md)
8
8
 
9
- Defined in: [packages/functions/src/headers.ts:180](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L180)
9
+ Defined in: [packages/functions/src/headers.ts:184](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L184)
10
10
 
11
11
  Returns the location information for the incoming request.
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  > **ipAddress**(`input`): `string` \| `undefined`
8
8
 
9
- Defined in: [packages/functions/src/headers.ts:131](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L131)
9
+ Defined in: [packages/functions/src/headers.ts:135](https://github.com/vercel/vercel/blob/main/packages/functions/src/headers.ts#L135)
10
10
 
11
11
  Returns the IP address of the request from the headers.
12
12
 
package/headers.js CHANGED
@@ -43,6 +43,9 @@ const EMOJI_FLAG_UNICODE_STARTING_POSITION = 127397;
43
43
  function getHeader(headers, key) {
44
44
  return headers.get(key) ?? void 0;
45
45
  }
46
+ function hasRequestHeaders(input) {
47
+ return "headers" in input && typeof input.headers?.get === "function";
48
+ }
46
49
  function getHeaderWithDecode(request, key) {
47
50
  const header = getHeader(request.headers, key);
48
51
  return header ? decodeURIComponent(header) : void 0;
@@ -56,7 +59,7 @@ function getFlag(countryCode) {
56
59
  );
57
60
  }
58
61
  function ipAddress(input) {
59
- const headers = "headers" in input ? input.headers : input;
62
+ const headers = hasRequestHeaders(input) ? input.headers : input;
60
63
  return getHeader(headers, IP_HEADER_NAME);
61
64
  }
62
65
  function getRegionFromRequestId(requestId) {
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "require": "./middleware.js"
31
31
  }
32
32
  },
33
- "version": "3.10.2",
33
+ "version": "3.10.4",
34
34
  "repository": {
35
35
  "directory": "packages/functions",
36
36
  "type": "git",
@@ -77,7 +77,7 @@
77
77
  "access": "public"
78
78
  },
79
79
  "dependencies": {
80
- "@vercel/oidc": "4.0.2"
80
+ "@vercel/oidc": "4.0.4"
81
81
  },
82
82
  "scripts": {
83
83
  "pretest": "pnpm run build:code",