diff --git a/packages/experiment-tag/src/messenger.ts b/packages/experiment-tag/src/messenger.ts index 80b0fa9..16c3df2 100644 --- a/packages/experiment-tag/src/messenger.ts +++ b/packages/experiment-tag/src/messenger.ts @@ -12,7 +12,7 @@ export class WindowMessenger { }>, ) => { const match = /^.*\.amplitude\.com$/; - if (!match.test(new URL(e.origin).hostname)) { + if (!e.origin || !match.test(new URL(e.origin).hostname)) { return; } if (e.data.type === 'OpenOverlay') {