stripe-experiment-sync 0.0.4 → 0.0.5
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/dist/index.cjs +12 -3
- package/dist/index.js +12 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1003,8 +1003,9 @@ var StripeAutoSync = class {
|
|
|
1003
1003
|
getBodyParserMiddleware() {
|
|
1004
1004
|
const webhookPath = this.options.webhookPath;
|
|
1005
1005
|
return (req, res, next) => {
|
|
1006
|
-
const path2 = req.path || req.url;
|
|
1007
|
-
if (path2
|
|
1006
|
+
const path2 = req.path || req.url || "";
|
|
1007
|
+
if (path2.startsWith(webhookPath)) {
|
|
1008
|
+
console.log("[BodyParser] Skipping webhook route:", path2);
|
|
1008
1009
|
return next();
|
|
1009
1010
|
}
|
|
1010
1011
|
import_express.default.json()(req, res, (err) => {
|
|
@@ -1022,6 +1023,12 @@ var StripeAutoSync = class {
|
|
|
1022
1023
|
const webhookRoute = `${this.options.webhookPath}/:uuid`;
|
|
1023
1024
|
app.use(webhookRoute, import_express.default.raw({ type: "application/json" }));
|
|
1024
1025
|
app.post(webhookRoute, async (req, res) => {
|
|
1026
|
+
console.log("[Webhook] Received request:", {
|
|
1027
|
+
path: req.path,
|
|
1028
|
+
url: req.url,
|
|
1029
|
+
method: req.method,
|
|
1030
|
+
contentType: req.headers["content-type"]
|
|
1031
|
+
});
|
|
1025
1032
|
const sig = req.headers["stripe-signature"];
|
|
1026
1033
|
if (!sig || typeof sig !== "string") {
|
|
1027
1034
|
console.error("[Webhook] Missing stripe-signature header");
|
|
@@ -1034,7 +1041,9 @@ var StripeAutoSync = class {
|
|
|
1034
1041
|
hasBody: !!rawBody,
|
|
1035
1042
|
bodyType: typeof rawBody,
|
|
1036
1043
|
isBuffer: Buffer.isBuffer(rawBody),
|
|
1037
|
-
bodyConstructor: rawBody?.constructor?.name
|
|
1044
|
+
bodyConstructor: rawBody?.constructor?.name,
|
|
1045
|
+
path: req.path,
|
|
1046
|
+
url: req.url
|
|
1038
1047
|
});
|
|
1039
1048
|
return res.status(400).send({ error: "Missing raw body for signature verification" });
|
|
1040
1049
|
}
|
package/dist/index.js
CHANGED
|
@@ -961,8 +961,9 @@ var StripeAutoSync = class {
|
|
|
961
961
|
getBodyParserMiddleware() {
|
|
962
962
|
const webhookPath = this.options.webhookPath;
|
|
963
963
|
return (req, res, next) => {
|
|
964
|
-
const path2 = req.path || req.url;
|
|
965
|
-
if (path2
|
|
964
|
+
const path2 = req.path || req.url || "";
|
|
965
|
+
if (path2.startsWith(webhookPath)) {
|
|
966
|
+
console.log("[BodyParser] Skipping webhook route:", path2);
|
|
966
967
|
return next();
|
|
967
968
|
}
|
|
968
969
|
express.json()(req, res, (err) => {
|
|
@@ -980,6 +981,12 @@ var StripeAutoSync = class {
|
|
|
980
981
|
const webhookRoute = `${this.options.webhookPath}/:uuid`;
|
|
981
982
|
app.use(webhookRoute, express.raw({ type: "application/json" }));
|
|
982
983
|
app.post(webhookRoute, async (req, res) => {
|
|
984
|
+
console.log("[Webhook] Received request:", {
|
|
985
|
+
path: req.path,
|
|
986
|
+
url: req.url,
|
|
987
|
+
method: req.method,
|
|
988
|
+
contentType: req.headers["content-type"]
|
|
989
|
+
});
|
|
983
990
|
const sig = req.headers["stripe-signature"];
|
|
984
991
|
if (!sig || typeof sig !== "string") {
|
|
985
992
|
console.error("[Webhook] Missing stripe-signature header");
|
|
@@ -992,7 +999,9 @@ var StripeAutoSync = class {
|
|
|
992
999
|
hasBody: !!rawBody,
|
|
993
1000
|
bodyType: typeof rawBody,
|
|
994
1001
|
isBuffer: Buffer.isBuffer(rawBody),
|
|
995
|
-
bodyConstructor: rawBody?.constructor?.name
|
|
1002
|
+
bodyConstructor: rawBody?.constructor?.name,
|
|
1003
|
+
path: req.path,
|
|
1004
|
+
url: req.url
|
|
996
1005
|
});
|
|
997
1006
|
return res.status(400).send({ error: "Missing raw body for signature verification" });
|
|
998
1007
|
}
|