tuum-tech / identify

MIT License
7 stars 3 forks source link

Snap Bundle Post-Processing Debugging on Secure ECMAScript Errors #76

Closed radleylewis closed 7 months ago

radleylewis commented 7 months ago

Note

This repository is awesome. Your work on approaching the MM Snap post-processing has been really helpful. Thank you!

Overview

The post-process.js code included in your snap is a well executed approach to addressing the ses eval errors on the bundle. We are looking to build a snap which uses additional @veramo/did-comm packages and are encountering errors on mm-snap eval.

Question

Are you able to outline your approach with respect to isolating offending code? In our specific case, the bundle size is > 147,000 lines and therefore makes it difficult to inspect. The specific error we are encountering is as per the below:

[TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot convert undefined or null to object at Function.keys (<anonymous>)]

Note

In some cases the error is more descriptive and so identifying what needs to be amending is easier. In this case I have been unable to isolate the offending code so I am particularly interested in your method/approach. Any help is greatly appreciated!

kpachhai commented 7 months ago

Thanks for the comment! As far as our experience goes, MM snap development is still in its infancy because it's very hard to work with sometimes especially when debugging errors. What we usually do is always build the snap, run the built version and then if we get any errors, we take a look at the error in detail and try to find the code in the built dist.js. It's very cumbersome sometimes though but this seems to work most of the time for us because of the way our snap is built.

radleylewis commented 7 months ago

Hi @kpachhai. Thanks for the response and for clarifying your approach. We have been essentially following the exact steps that you have outlined. However, in the case of the error I linked above, there is no information with respect to where in the bundle the issue is. I've been trying many different approaches, and in other cases the post-processing was more straightforward (e.g. the function name was available in the error so isolating the offending code was easier).

Not sure if you had any specific approaches with respect to debugging or identifying the exact line of offending code? In any case, thanks for your response and the great work you have done.

kpachhai commented 7 months ago

Hi @kpachhai. Thanks for the response and for clarifying your approach. We have been essentially following the exact steps that you have outlined. However, in the case of the error I linked above, there is no information with respect to where in the bundle the issue is. I've been trying many different approaches, and in other cases the post-processing was more straightforward (e.g. the function name was available in the error so isolating the offending code was easier).

Not sure if you had any specific approaches with respect to debugging or identifying the exact line of offending code? In any case, thanks for your response and the great work you have done.

I would encourage you to ask your question on the metamask snap discussion board - https://github.com/MetaMask/snaps/discussions