joule-labs / webln

Spec and client library for WebLN apps and providers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Must be called in a browser context

whiteyhat opened this issue · comments

Hey!

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

Hey!

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

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.