@pinelab/vendure-plugin-sendcloud 1.2.1 → 1.2.2

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,4 +1,8 @@
1
- # 1.2.1 (2022-01-16)
1
+ # 1.2.2 (2024-06-13)
2
+
3
+ - Added better logging for failing incoming webhooks
4
+
5
+ # 1.2.1 (2023-01-16)
2
6
 
3
7
  - Correctly transition order to Delivered after it has been Shipped
4
8
 
@@ -19,12 +19,20 @@ const sendcloud_client_1 = require("./sendcloud.client");
19
19
  const core_1 = require("@vendure/core");
20
20
  const constants_1 = require("./constants");
21
21
  const sendcloud_types_1 = require("./types/sendcloud.types");
22
+ const util_1 = require("util");
22
23
  let SendcloudController = class SendcloudController {
23
24
  constructor(sendcloudService) {
24
25
  this.sendcloudService = sendcloudService;
25
26
  }
26
27
  async webhook(req, signature, channelToken) {
27
- const body = JSON.parse(req.body.toString());
28
+ let body;
29
+ try {
30
+ body = JSON.parse(req.body.toString());
31
+ }
32
+ catch (e) {
33
+ core_1.Logger.error(`Error parsing incoming webhook body: ${e?.message ?? e}`, constants_1.loggerCtx, (0, util_1.inspect)(req.body));
34
+ return;
35
+ }
28
36
  const rawBody = req.rawBody;
29
37
  const ctx = await this.sendcloudService.createContext(channelToken);
30
38
  const { client } = await this.sendcloudService.getClient(ctx);
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@pinelab/vendure-plugin-sendcloud",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Vendure plugin for syncing orders with SendCloud",
5
- "icon": "truck",
6
5
  "author": "Martijn van de Brug <martijn@pinelab.studio>",
7
6
  "homepage": "https://pinelab-plugins.com/",
8
7
  "repository": "https://github.com/Pinelab-studio/pinelab-vendure-plugins",
@@ -21,7 +20,8 @@
21
20
  "scripts": {
22
21
  "build": "rimraf dist && tsc && copyfiles -u 1 'src/ui/**/*' dist/vendure-plugin-sendcloud/src/",
23
22
  "test": "vitest run",
24
- "start": "yarn ts-node test/dev-server.ts"
23
+ "start": "yarn ts-node test/dev-server.ts",
24
+ "lint": "echo 'No linting configured'"
25
25
  },
26
- "gitHead": "f2584b3c12624d023dcf9a10383e1c074e35b5d5"
26
+ "gitHead": "7531c167693e3a991ef910c6d398658547d313bb"
27
27
  }