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:
@@ -45,6 +45,7 @@ export default async (request: IRequest, response: Response) => {
|
|||||||
|
|
||||||
// in case trigger type is 'webhook'
|
// in case trigger type is 'webhook'
|
||||||
let payload = request.body;
|
let payload = request.body;
|
||||||
|
let rawInternalId: string | Buffer = request.rawBody;
|
||||||
|
|
||||||
// in case it's our built-in generic webhook trigger
|
// in case it's our built-in generic webhook trigger
|
||||||
if (isWebhookApp) {
|
if (isWebhookApp) {
|
||||||
@@ -53,12 +54,14 @@ export default async (request: IRequest, response: Response) => {
|
|||||||
body: request.body,
|
body: request.body,
|
||||||
query: request.query,
|
query: request.query,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rawInternalId = JSON.stringify(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerItem: ITriggerItem = {
|
const triggerItem: ITriggerItem = {
|
||||||
raw: payload,
|
raw: payload,
|
||||||
meta: {
|
meta: {
|
||||||
internalId: await bcrypt.hash(request.rawBody, 1),
|
internalId: await bcrypt.hash(rawInternalId, 1),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -108,7 +108,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
|
|||||||
{!!error?.graphQLErrors?.length && (
|
{!!error?.graphQLErrors?.length && (
|
||||||
<Alert
|
<Alert
|
||||||
severity="error"
|
severity="error"
|
||||||
sx={{ mb: 1, fontWeight: 500, width: '100%' }}
|
sx={{ mb: 2, fontWeight: 500, width: '100%' }}
|
||||||
>
|
>
|
||||||
{serializeErrors(error.graphQLErrors).map((error: any) => (
|
{serializeErrors(error.graphQLErrors).map((error: any) => (
|
||||||
<div>{error.message}</div>
|
<div>{error.message}</div>
|
||||||
@@ -116,7 +116,9 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement {
|
|||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{step.webhookUrl && <WebhookUrlInfo webhookUrl={step.webhookUrl} />}
|
{step.webhookUrl && (
|
||||||
|
<WebhookUrlInfo webhookUrl={step.webhookUrl} sx={{ mb: 2 }} />
|
||||||
|
)}
|
||||||
|
|
||||||
{hasNoOutput && (
|
{hasNoOutput && (
|
||||||
<Alert severity="warning" sx={{ mb: 1, width: '100%' }}>
|
<Alert severity="warning" sx={{ mb: 1, width: '100%' }}>
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
|
import type { AlertProps } from '@mui/material/Alert';
|
||||||
|
|
||||||
import { generateExternalLink } from '../../helpers/translation-values';
|
import { generateExternalLink } from '../../helpers/translation-values';
|
||||||
import { WEBHOOK_DOCS } from '../../config/urls';
|
import { WEBHOOK_DOCS } from '../../config/urls';
|
||||||
@@ -9,13 +10,13 @@ import { Alert } from './style';
|
|||||||
|
|
||||||
type WebhookUrlInfoProps = {
|
type WebhookUrlInfoProps = {
|
||||||
webhookUrl: string;
|
webhookUrl: string;
|
||||||
};
|
} & AlertProps;
|
||||||
|
|
||||||
function WebhookUrlInfo(props: WebhookUrlInfoProps): React.ReactElement {
|
function WebhookUrlInfo(props: WebhookUrlInfoProps): React.ReactElement {
|
||||||
const { webhookUrl } = props;
|
const { webhookUrl, ...alertProps } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Alert icon={false} color="info">
|
<Alert icon={false} color="info" {...alertProps}>
|
||||||
<Typography variant="body2" textAlign="center">
|
<Typography variant="body2" textAlign="center">
|
||||||
<FormattedMessage id="webhookUrlInfo.title" />
|
<FormattedMessage id="webhookUrlInfo.title" />
|
||||||
</Typography>
|
</Typography>
|
||||||
|
Reference in New Issue
Block a user