feat(webhook/handler): use UUID for internal ids
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Crypto from 'node:crypto';
|
||||
import { Response } from 'express';
|
||||
import bcrypt from 'bcrypt';
|
||||
import { IRequest, ITriggerItem } from '@automatisch/types';
|
||||
|
||||
import Flow from '../../models/flow';
|
||||
@@ -57,7 +57,6 @@ export default async (request: IRequest, response: Response) => {
|
||||
|
||||
// in case trigger type is 'webhook'
|
||||
let payload = request.body;
|
||||
let rawInternalId: string | Buffer = request.rawBody;
|
||||
|
||||
// in case it's our built-in generic webhook trigger
|
||||
if (isWebhookApp) {
|
||||
@@ -66,14 +65,12 @@ export default async (request: IRequest, response: Response) => {
|
||||
body: request.body,
|
||||
query: request.query,
|
||||
};
|
||||
|
||||
rawInternalId = JSON.stringify(payload);
|
||||
}
|
||||
|
||||
const triggerItem: ITriggerItem = {
|
||||
raw: payload,
|
||||
meta: {
|
||||
internalId: await bcrypt.hash(rawInternalId, 1),
|
||||
internalId: Crypto.randomUUID(),
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user