Merge pull request #787 from automatisch/fix-generic-webhook-internal-id-for-get-reqs

fix(webhook): correct internal ID for GET requests
This commit is contained in:
Ali BARIN
2022-12-08 23:09:06 +01:00
committed by GitHub
3 changed files with 12 additions and 6 deletions

View File

@@ -45,6 +45,7 @@ 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) {
@@ -53,12 +54,14 @@ 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(request.rawBody, 1),
internalId: await bcrypt.hash(rawInternalId, 1),
},
};

View File

@@ -108,7 +108,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
{!!error?.graphQLErrors?.length && (
<Alert
severity="error"
sx={{ mb: 1, fontWeight: 500, width: '100%' }}
sx={{ mb: 2, fontWeight: 500, width: '100%' }}
>
{serializeErrors(error.graphQLErrors).map((error: any) => (
<div>{error.message}</div>
@@ -116,7 +116,9 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
</Alert>
)}
{step.webhookUrl && <WebhookUrlInfo webhookUrl={step.webhookUrl} />}
{step.webhookUrl && (
<WebhookUrlInfo webhookUrl={step.webhookUrl} sx={{ mb: 2 }} />
)}
{hasNoOutput && (
<Alert severity="warning" sx={{ mb: 1, width: '100%' }}>

View File

@@ -1,6 +1,7 @@
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import Typography from '@mui/material/Typography';
import type { AlertProps } from '@mui/material/Alert';
import { generateExternalLink } from '../../helpers/translation-values';
import { WEBHOOK_DOCS } from '../../config/urls';
@@ -9,13 +10,13 @@ import { Alert } from './style';
type WebhookUrlInfoProps = {
webhookUrl: string;
};
} & AlertProps;
function WebhookUrlInfo(props: WebhookUrlInfoProps): React.ReactElement {
const { webhookUrl } = props;
const { webhookUrl, ...alertProps } = props;
return (
<Alert icon={false} color="info">
<Alert icon={false} color="info" {...alertProps}>
<Typography variant="body2" textAlign="center">
<FormattedMessage id="webhookUrlInfo.title" />
</Typography>