From e4432f7ea402330783067fe37a9550581eedb876 Mon Sep 17 00:00:00 2001 From: Richard Fontein <32132657+rifont@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:16:13 +0100 Subject: [PATCH] fix(node): Remove bridge URL generation for Next.js preview deployments (#6283) --- packages/node/package.json | 2 +- packages/node/src/lib/events/events.spec.ts | 26 --------------------- packages/node/src/lib/events/events.ts | 4 ---- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/node/package.json b/packages/node/package.json index 663cd9dbb79..8925b5937c5 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,6 +1,6 @@ { "name": "@novu/node", - "version": "2.0.0-canary.0", + "version": "2.0.0-canary.1", "description": "Notification Management Framework", "main": "build/main/index.js", "typings": "build/main/index.d.ts", diff --git a/packages/node/src/lib/events/events.spec.ts b/packages/node/src/lib/events/events.spec.ts index dae9d70f793..57415865393 100644 --- a/packages/node/src/lib/events/events.spec.ts +++ b/packages/node/src/lib/events/events.spec.ts @@ -37,32 +37,6 @@ describe('test use of novus node package - Events', () => { }); }); - test('should generate bridge URL correctly', async () => { - mockedAxios.post.mockResolvedValue({}); - process.env.NEXT_PUBLIC_VERCEL_URL = 'example.com'; - const expectedUrl = `https://${process.env.NEXT_PUBLIC_VERCEL_URL}/api/novu`; - - await novu.events.trigger('test-template', { - to: 'test-user', - payload: { - email: 'test-user@sd.com', - }, - }); - - expect(mockedAxios.post).toHaveBeenCalled(); - expect(mockedAxios.post).toHaveBeenCalledWith('/events/trigger', { - name: 'test-template', - to: 'test-user', - overrides: {}, - payload: { - email: 'test-user@sd.com', - }, - bridgeUrl: expectedUrl, - }); - - delete process.env.NEXT_PUBLIC_VERCEL_URL; - }); - test('should broadcast correctly', async () => { mockedAxios.post.mockResolvedValue({}); diff --git a/packages/node/src/lib/events/events.ts b/packages/node/src/lib/events/events.ts index fbb55d8140f..8d940d77e85 100644 --- a/packages/node/src/lib/events/events.ts +++ b/packages/node/src/lib/events/events.ts @@ -8,10 +8,6 @@ import { WithHttp } from '../novu.interface'; export class Events extends WithHttp implements IEvents { async trigger(workflowIdentifier: string, data: ITriggerPayloadOptions) { - if (!data.bridgeUrl && process.env.NEXT_PUBLIC_VERCEL_URL) { - data.bridgeUrl = `https://${process.env.NEXT_PUBLIC_VERCEL_URL}/api/novu`; - } - return await this.http.post(`/events/trigger`, { name: workflowIdentifier, to: data.to,