Debug a Snap
To debug your Snap, use console.log
and inspect the MetaMask background process.
You can also see the common issues encountered by Snap developers.
You can add your log statements in your source code and build your Snap, or add them directly
to your Snap bundle and use yarn mm-snap manifest --fix
to update the shasum
in your Snap manifest file.
The manifest shasum
must match the contents of your bundle at the time MetaMask fetches your Snap.
Because adding logs modifies the Snap source code, you must re-install the Snap whenever you add a log statement.
The Snap log output is only visible in the extension background process console. If you're using a Chromium browser, use the following steps to inspect the background process and view its console:
- Go to
chrome://extensions
. - Toggle Developer mode on in the top right corner.
- Find MetaMask Flask, and select Details.
- Under Inspect views, select
background.html
.
The log output displays in the console that pops up.