-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[React Native] Cannot read property 'decode' of undefined #13
Comments
Thanks for your interest in apg.js and pointing out this problem with React Native. As I've mentioned in other issues, I haven't worked with apg.js for a couple of years now and I'm a little rusty with it. Also, I have never worked with React Native. I am completely unfamiliar with it. That said, it does look interesting and I may come back to apg.js and fix it to work with RN sometime in the future. Unfortunately, I'm "out of the office" for a few months and likely won't get back to this until later this year. In the meantime you appear to have a private fix you can work with. Regarding your pull request: I can't accept a pull request until 1) I understand all of the changes personally and 2) I have convinced myself that the changes will not break other applications. Also, since all of the "...bundle.js" files are generated from the source files the correct procedure would be to fix the source files and regenerate the bundle files. So, again, thanks for pointing this problem out to me and piquing my interest in React Native. |
Hello, sorry for revisiting this. I'm one of the maintainers of a library that uses |
Well, this is interesting. I have noticed for some time that the siwe project was responsible for a large percentage of the downloads reported on npm. In fact, it was mainly siwe that I was thinking of when I declined the previous PR for fear of breaking existing projects. So I really do want to cooperate and help out here. Unfortunately, I'm looking at 1) a learning curve to get back up to speed with JS and my own project and 2) no time to do it right now. I'm in transition and it will probably not be until late July or August before I have my development environment set up again. If you can wait I'm willing to help out. If not, I'm open to suggestions. |
Sure thing, this only popped up for us recently. There was another PR that wanted to add |
Don't want to pile on, but this popped up for us recently as well. For additional context, we are not using ReactNative, but rather the Vite build tool (just swapped over from Create-React-App). No amount of polyfilling would do the trick, so I had to dive in pretty deep to finally stumble upon this project/package as the partial culprit. From all of my debugging and attempting various solutions, it seems that Vite was treating the No rush on the fix, but wanted to add another example scenario. Also happy to help out with chatting through possible solutions and or testing any findings |
Thanks. Will be happy to keep you in the loop and discussions when I get back to this. I would like to get a version that works for everybody, if that's possible. |
I have also ran into this issue and made a PR with changes that I'm using with npm link in my build system to fix the dependency issue. As noted in the PR I believe that changing to exports will keep compatibility with users who are using this package as a commonjs module but will allow it to be converted to an ES module for people that need that. Also for context I came across this issue as I'm using SIWE and Vite |
I think (hope) you are right on this. I'll give it a try when I can. As I've mentioned above, I'm in transition - as in moving - and I will not be relocated and have my development environment back up and running until July or August. I hope I can make these changes then and we can all work together to confirm that everyone is happy with the updated apg-js in their application or environment. Sorry I can't jump on this sooner but life happens. |
Sure thing. Thanks for your attention |
So, I've spent the last two weeks or so trying to get my head back into JavaScript and
along with all the other related
So I'm open to suggestions. I'm basically ready to publish a new version of |
I'm not clear to me that you will be able to use require('node:buffer') when building for the browser. Essentially the node: prefix indicates that you want to use the buffer provided by the node runtime but the runtime in the browser doesn't provide a buffer implementation. This is why we need to polyfill buffer when bundling for the browser and it's not clear to me if the node: prefix will allow us to polyfill. It might do but I've not tried before. Also can you push what you've got so far and we can have a play to see what's possible? |
Let me spend a day or two experimenting with that and maybe a couple of other things. If I can't get something working then I will consider pushing a version with broken web bundles (or just without the bundles) and let you experiment with it in your applications. I have no experience with ReactNative or Vite. Are you saying that |
To use buffer in the browser it has to be polyfilled. For Vite I'm using rollup-plugin-node-polyfills to do this. So with my react vite setup there are some packages that require or import buffer - not node:buffer. I just changed one of the imports to node:buffer and I got it to work with adding a resolve alias. This is not a full vite config but I think these are the relevant parts from my config that relate to getting buffer included correctly
|
Also I think the issue that the user in #16 is experiencing is because they are using cloudflare workers which polyfills buffer to node:buffer but this would not be common compared to the way that buffer is normally polyfilled to the browser even if it is more technically correct in the way it mirrors how nodejs is now encouraging users to include buffer server side. |
Thanks for your comments and suggestions. Removing the |
Ok. Try it now. I've published |
I'm closing this for now. If |
Just to let you know this is now working for us. Thanks for your attention. |
Thanks for letting me know. I was just assuming that no news was good news but thank you. It was fun getting back into JavaScript and npm. |
This error is located at apg-conv-api/transformers.js line 801.
The text was updated successfully, but these errors were encountered: