Just a wild guess, but are you sure about this line;
const key = '<pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76>';
I would try it without the lt/gt´s.
BTW If pk stands for “Public Key”, no worries. But, if it means “Private Key”, consider it now to be compromised, so get a new one.