opengsn/gsn

Use @opengsn/provider in React

Closed this issue · 2 comments

I use @opengsn/provider in React project and got error. After checking, I found that this package use winston logger, which depend on Nodejs module 'os'. I also check ui in the workshop (https://github.com/opengsn/workshop.git), but it uses raw html. How do I use @opengsn/provider in React (or Vue, Angular).

Hello @akkien!
I believe this issue will be resolved by the upcoming migration to v3.0 as it no longer requires winston logger package directly.
However, if you are using GSN v.2, it does work with React. Our sample application is written with React:
https://github.com/opengsn/ctf-react/tree/ver2.2.x

There are frameworks that use Webpack internally, and these do fail with importing Node.js modules. I see that our docs site only mentions "Gatsby" and "Next.JS", but I assume others should have a similar configuration:
https://docs-v2.opengsn.org/faq/troubleshooting.html#my-client-fails-with-an-error-can-t-resolve-fs

Can you please tell me what framework are you using, if any?

Thank you @forshtat,

I mimic the approach of the workshop (run browserify and import .js file into index.html) and success integrates @opengsn/provider into my React application.

I checked the repo ctf-react, the problem is not GSN version v2 or v3. ctf-react can run properly because it use react-scripts@3.4.3. => I will investigate more on webpack to config my application to work with the newest version of react-scripts.