Version mismatch?: const { RelayProvider } = require('@opengsn/gsn')

I’m getting some typo error while getting the GSN provider with my gsn contracts running in Ganache chain with version @opengsn/gsn": "^2.1.0 with contracts version v 6.0:
webconsole: SyntaxError: missing : after property id

import Web3 from "web3/dist/web3.min.js";
const  PROVIDER_URL = "ws://";
const GSN =  { //development addresses
  RelayHub: '0x59d3631c86BbE35EF041872d502F218A39FBa150',
  StakeManager: '0xC89Ce4735882C9F0f0FE26686c53074E09B0D550',
  Penalizer: '0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb',
  TrustedForwarder: '0xe982E462b094850F12AF94d21D470e21bE9D0E9C',
  Paymaster: '0x9561C133DD8580860B6b7E504bC5Aa500f0f06a7'

const { RelayProvider } = require('@opengsn/gsn')

const config = {
    paymasterAddress: GSN.Paymaster,
    loggerConfiguration: {
        logLevel: 'debug'
    // loggerUrl: '',
const provider = await RelayProvider.newProvider({ provider: web3.currentProvider, config }).init()
const web3 = new Web3(provider);

dependencies": {
    "@opengsn/gsn": "^2.1.0",
    "@openzeppelin/cli": "^2.8.2",
    "@openzeppelin/contracts": "^3.4.1",
    "babel": "^6.23.0",
    "core-js": "^3.6.4",
    "vue": "^2.6.11",
    "vue-router": "^3.3.4",
    "vuex": "^3.4.0",
    "web3": "1.2.7"

in my contract:

function versionRecipient() external virtual view override returns (string memory) {
  return "1.0.1";

this looks like a javascript error, and the compiler should report your the exact typo place.

I ran yarn to compile and could see it’s looks like a node version issue:

s incompatible with this module. Expected ver
sion ">=11.0.0". Got "10.16.3"               
error Found incompatible module```

I used nvm to set the node version to version >=11 (see below) but get same ‘version’ error involving webpack …

How do i check which version node a specific package needs?

"engines": {
    "node": ">=11"

I emptied the node module folder and reloaded… same error

Ive checked in a variety of browsers (Opera mobile, old and new Chorme, Firefox…) one hint is the error line in console


I suggest using node 12 at least (that’s what we use), and verify with “node --version” that you’re using the right version.
also, I’m not sure what you mean with “contracts version v 6.0”
I suggest you follow one of our tests (,

1 Like

@drortirosh I still get error : with everything set up with Node version 12 and connecting to my Ganache instance with funded test accounts …when trying to wrap the web3 with GSN provider , this line alone: const { RelayProvider } = require("@opengsn/gsn") gives me error in console:

RelayProvider.js?57e8:33 Uncaught SyntaxError: Unexpected identifier

Ive narrowed it down to that import statement. I have version “@opengsn/gsn”: “^2.1.0”, in my dependencies .

Is it possible that web3 doesn’t play nice with RelayProvider? I tried web3 version 1.3.2 and 1.2.7 and get the same error…

I tried importing the compiled …/dist/RelayProvider.js also

@drortirosh I noticed in the example

Web3 isn’t listed as a dependency… yet , unless I am mistaken RelayProvider is a wrapper for a running web3 or a standalone web3??

Truffle already requires web3, so it is implicitly added into the project.
truffle also has a “web3” global object, pre-initialized with something like Web3=require('web3'); web3 = new Web3(...)

please try to narrow it down to a test running from command-line first, and then try to load it from a browser.