Skip to content

Commit e5750be

Browse files
committed
Fix
1 parent ec2ee46 commit e5750be

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

packages/server/api/src/app/flow-template/cloud-template.controller.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
2323
return;
2424
}
2525

26+
// cloud templates are available on any origin
27+
app.addHook('onRequest', allowAllOriginsHookHandler);
28+
2629
app.get(
2730
'/',
2831
{
29-
onSend: [allowAllOriginsHookHandler],
3032
config: {
3133
allowedPrincipals: ALL_PRINCIPAL_TYPES,
3234
skipAuth: true,
@@ -68,7 +70,6 @@ export const cloudTemplateController: FastifyPluginAsyncTypebox = async (
6870
app.get(
6971
'/:id',
7072
{
71-
onSend: [allowAllOriginsHookHandler],
7273
config: {
7374
allowedPrincipals: ALL_PRINCIPAL_TYPES,
7475
skipAuth: true,

packages/server/api/src/app/helper/allow-all-origins-hook-handler.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { onSendHookHandler } from 'fastify/types/hooks';
1+
import { onRequestHookHandler } from 'fastify/types/hooks';
22

3-
export const allowAllOriginsHookHandler: onSendHookHandler = (
3+
export const allowAllOriginsHookHandler: onRequestHookHandler = (
44
request,
55
reply,
6-
payload,
76
done,
87
) => {
98
void reply.header(
@@ -24,6 +23,5 @@ export const allowAllOriginsHookHandler: onSendHookHandler = (
2423
return reply.status(204).send();
2524
}
2625

27-
done(null, payload);
28-
return;
26+
done();
2927
};

packages/server/api/src/app/user-info/user-info.module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const userInfoController: FastifyPluginAsyncTypebox = async (app) => {
2222
}
2323

2424
// user-info is available on any origin
25-
app.addHook('onSend', allowAllOriginsHookHandler);
25+
app.addHook('onRequest', allowAllOriginsHookHandler);
2626

2727
app.get(
2828
'/',

0 commit comments

Comments
 (0)