gcf-common-lib 0.41.0 → 0.42.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/package.json +1 -1
  2. package/src/index.ts +2 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcf-common-lib",
3
3
  "description": "Common helpers for Google Cloud Functions: Pub/Sub publishing, Mongo helpers, and utilities for Node 20+ (TypeScript).",
4
- "version": "0.41.0",
4
+ "version": "0.42.0",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "branches": [
package/src/index.ts CHANGED
@@ -172,10 +172,10 @@ export const GcfCommon = {
172
172
  },
173
173
 
174
174
  getRequestMessage(request: Request) {
175
- return request.body.message as { attributes: TMetadataOrAttributes; data: string; json?: Dict<any> };
175
+ return request?.body?.message as { attributes: TMetadataOrAttributes; data: string; json?: Dict<any> };
176
176
  },
177
177
 
178
178
  getRequestAttributes(request: Request) {
179
- return { ...this.getRequestMessage(request)?.attributes, ...request.headers };
179
+ return { ...this.getRequestMessage(request)?.attributes, ...request?.headers };
180
180
  },
181
181
  };