I'm trying to add a small amount of web3 code to a react component. When I do so, I'm getting a DataCloneError. The component is as follows:

import React, { Component } from 'react';
import Web3 from 'web3';

class App extends Component {
  async componentDidMount() {
    const web3 = new Web3(window.ethereum);
    await window.ethereum.enable()

  render() {
    return (
        Hello Web3

export default App;

The error I'm getting is

inpage.js:1 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': function (error, response) {
            if (!error) {

        ...<omitted>... } could not be cloned.
    at i._write (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:114976)
    at b (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:133822)
    at w (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:134428)
    at i.g.uncork (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:137191)
    at i._onMessage (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/inpage.js:1:114856)

What am I doing wrong?

  • I have a similar issue with web3 1.0.0 beta46 and beta47. It works with beta33. Which version are you using?
    – szerte
    Mar 4, 2019 at 15:10
  • I was using beta47. reverting to beta33 ressolved it.
    – jeffery
    Mar 4, 2019 at 23:11

1 Answer 1


Reverting to [email protected] resolved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.