verygoodsecurity / vgs-collect-js

VGS Collect.js script loading module
https://www.verygoodsecurity.com/
7 stars 17 forks source link

Fails with Next.js (SSR) #29

Closed HashirSalam closed 3 years ago

HashirSalam commented 3 years ago

Expected Behavior

Should be able to use it with SSR.

Current Behavior

The app crashes with the following error:

Screen Shot 2021-09-09 at 1 50 31 PM

Possible Solution

Adding the following check solves the problem:

Screen Shot 2021-09-09 at 1 51 13 PM

Steps to Reproduce (for bugs)

  1. npm i @vgs/collect-js
  2. import { loadVGSCollect } from '@vgs/collect-js';
  3. Try to load the component and the app will crash

Context

Currently, it's unusable with Next.js (SSR)

Your Environment

Next.js (11.0) MacOS Chrome @vgs/collect-js": "^0.4.0"

AnnaKudriasheva commented 3 years ago

@HashirSalam thank you for pointing it out! The fix should be deployed to production soon. The new release is planned for Monday.

AnnaKudriasheva commented 3 years ago

@HashirSalam we've released a new version of the package - 0.5.0. Could you please update and let us know if it works now as expected. Thank you!

HashirSalam commented 3 years ago

@AnnaKudriasheva Yes we tried it with latest version ( 0.5.0). It works fine now, Thanks for the quick response.