joule-labs / webln

Spec and client library for WebLN apps and providers
244 stars 28 forks source link

Error: Must be called in a browser context #7

Closed whiteyhat closed 5 years ago

whiteyhat commented 5 years ago

Hey!

Is there any specific reason to be called from the browser context, or can be avoided?

whiteyhat commented 5 years ago

Hey!

Is there any specific reason to be called from the browser context, or can be avoided called form the server side?

wbobeirne commented 5 years ago

Hey there!

This has to be done in the browser context because the extension injects the WebLN provider into the page. Your server cannot prompt the user to do things, only client software can (e.g. web browser, browser extension, native app etc.)

If you're having issues with using node packages on the frontend, I suggest you look into a bundler such as webpack or rollup. This is a pretty common part of the build process for modern web apps.