near-api-js icon indicating copy to clipboard operation
near-api-js copied to clipboard

process not defined in all environments

Open mattlockyer opened this issue 3 years ago • 2 comments

Describe the bug I use NAJ in cloudflare workers and there is not process and of course no process.env so the following code throws errors:

https://github.com/near/near-api-js/blob/689705926fe437b8d8671d72e77148228c895992/lib/utils/errors.js#L31

I think this was introduced with the events that were recently added?

To Reproduce Steps to reproduce the behavior: 1. Run signAndSendTransaction in any environment without process.env

Expected behavior It works

Additional context I recommend checking ALSO if process is defined first, then checking process.env so that envs without process defined can still use these methods.

mattlockyer avatar Nov 27 '21 03:11 mattlockyer

Hey @mattlockyer, thanks for reporting! Can I get some more info about how you setup near-api-js on a cloudflare worker? We'd like to repro this to decide how to proceed 🙂

esaminu avatar Aug 19 '22 16:08 esaminu

Hey @mattlockyer, a kind reminder for the comment above. Thank you.

erditkurteshiSQA avatar Sep 15 '22 12:09 erditkurteshiSQA