diff --git a/apps/viewer/pages/api/publicTypebots/[typebotId].ts b/apps/viewer/pages/api/publicTypebots/[typebotId].ts index 11f5688c2..34efcdff2 100644 --- a/apps/viewer/pages/api/publicTypebots/[typebotId].ts +++ b/apps/viewer/pages/api/publicTypebots/[typebotId].ts @@ -1,9 +1,13 @@ import { withSentry } from '@sentry/nextjs' import prisma from 'libs/prisma' import { NextApiRequest, NextApiResponse } from 'next' -import { methodNotAllowed, notFound } from 'utils' +import Cors from 'cors' +import { initMiddleware, methodNotAllowed, notFound } from 'utils' + +const cors = initMiddleware(Cors()) const handler = async (req: NextApiRequest, res: NextApiResponse) => { + await cors(req, res) if (req.method === 'GET') { const typebotId = req.query.typebotId as string const typebot = await prisma.publicTypebot.findUnique({