🚀
Tonomy Developer Docs
  • Introduction
    • Features
  • Build Web4 Apps
    • Install
    • Register your Web4 App
    • Login
    • User Data and Logout
    • Sign Verifiable Credentials
    • Server Authentication
    • Smart Contracts
      • Develop
      • Deploy
      • 1-Click Transactions
      • Wallet Signing
    • Send P2P Messages
    • Troubleshooting
  • Multi-Chain Transactions + Crypto
    • Wallet Connect
    • Antelope Sigining Request (ESR)
  • Run Tonomy Infrastructure
    • Overview
      • Configuration
      • What software to run?
    • Node Setup
      • Setup
      • Run an API Node
      • Run a Block Producer Node
      • Becoming a Block Producer on Tonomy
    • API Endpoints
    • Hardware Requirement
    • Troubleshooting
  • Connect as an Exchange
  • Run Tonomy Gov OS
    • Technical requirements
    • Deploy Tonomy ID
    • Deploy a web wallet with the SDK
    • Reference
      • Application Interface (API)
      • Software Development Kit (SDK)
    • Troubleshooting
Powered by GitBook
On this page
  • Pure ESM compile (Commonjs not supported)
  • The jsonld ecosystem
  • React Native / Expo apps​
  • yarn package management linking issues
  • Error: Cannot read 'getResolver' of undefined
  • TypeError: Failed to execute 'fetch' on 'Window'
  • Further support
  1. Build Web4 Apps

Troubleshooting

PreviousSend P2P MessagesNextMulti-Chain Transactions + Crypto

Last updated 14 days ago

Pure ESM compile (Commonjs not supported)

We have adopted ESM syntax for the Tonomy codebase because of dependencies that we use that have taken a "pure ESM" stance.

You cannot consume the Tonomy SDK in a Commonjs project such as a default Node.js or Jest compiler.

Please change your compiler to target ESM.

  • Ensure "type": "module" in package.json

  • Use Nodejs ≥ 20.00

You may also need to set the environment variable NODE_OPTIONS="--experimental-vm-modules"

What is causing this?

We use the libraries, which use pure ESM components. See for more details. Check out our to pure-ESM.

The jsonld ecosystem

The Tonomy library use the Verifiable Credentials libraries (like @veramo/credential-ld) which depend on a set of libraries from the jsonld ecosystem which weren't designed with the same multi-platform targets in mind. Forks of these dependencies exist, that work in all environments where Veramo should work, but you have to aid your package manager in finding them.

The solution is to add a resolutions (or overrides) block to your package.json file and replacing the problematic dependencies:

package.json
"resolutions": {
    "jsonld": "link:./node_modules/@digitalcredentials/jsonld"
  },

Different package managers use different configurations for such overrides:

package.json
"resolutions": {
  "isomorphic-webcrypto": "npm:@sphereon/isomorphic-webcrypto@^2.4.0"
}

yarn package management linking issues

Try use yarn with node-modules:

.yarnrc.yml
nodeLinker: node-modules

Error: Cannot read 'getResolver' of undefined

TypeError: Failed to execute 'fetch' on 'Window'

You need to override the fetch object used by the SDK when your app loads. Do this at the same time as you call setSettings()

import { setFetch } from '@tonomy/tonomy-id-sdk';

setFetch(window.fetch.bind(window));

Further support

See the for more details.

React Native / Expo apps

If your project is a react-native app, then you will also benefit from replacing isomorphic-webcrypto with the

See the for more details.

This has been observed in vite/quasar apps in development mode. To resolve see here:

Send us a message in the :

channel

channel for anything sensitive

veramo.io
here
PRs to convert our codebases
npm overrides
yarn v2+ resolutions
yarn v1 resolutions
pnpm resolutions
​
fork maintained by Sphereon
https://github.com/decentralized-identity/ethr-did-resolver/issues/186#issuecomment-1870230086
Tonomy Discord
#builders-discussion
#open-ticket
veramo troubleshooting issue
veramo troubleshooting issue