Issue in @forge/bridge router.open method

Hi, I’m kind of new to forge development and trying to use @forge/bridge router.open(https://google.com) method to open a new window. However, every time in forge deploy it throws an error in the snapshot stage Error: Error thrown in the snapshot context. App code snapshot error: Snapshot error occurred: Error: window is not defined. I already tried using useEffect and other suggested solutions without luck. This is my code snippet:


Apologize in advance if this is some kind of silly doubt…

Hi, I was able to resolve the issue by adding router.open in the static assets. It was obvious that I need to call this function from the frontend, however didn’t know how to implement this. Worked great with custom-ui.

Thanks!!

2 Likes