question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`transactionExports is not a constructor` - vite-react project

See original GitHub issue

Hey 😃 One of the projects using Warp SDK reported a bug in their vite-react project (it appears only on production, dev is ok).

Screenshot 2022-07-25 at 15 33 35

Error seems to be thrown by the SDK when creating arweave transaction. This is how we do it:

  async tx(id: string): Promise<typeof Transaction> {
    const response = await fetch(`${this.baseUrl}/tx/${id}`)
      .then((res) => {
        return res.ok ? res.json() : Promise.reject(res);
      })
      .catch((error) => {
        if (error.body?.message) {
          this.logger.error(error.body.message);
        }
        throw new Error(`Unable to retrieve tx ${id}. ${error.status}. ${error.body?.message}`);
      });

    return new Transaction({
      ...response
    });
  }

Error is thrown in the return part when initializing Transaction. This is how it is imported:

import Transaction from 'arweave/node/lib/transaction';

The error is shown also if I’m trying to create a transaction directly in the project (without intermediation of sdk) - importing exactly like shown above and then new Transaction(tx). If you need any more info or a sample github repo, I’m happy to deliver 😃

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ppedziwiatrcommented, Aug 17, 2022

@rosmcmahon what do you mean? Our SDK is using arweave-js and so has arweave-js in its package.json dependencies…how do you suggest to handle this differently? I guess that’s more of an issue with npm dependency system in general 😃

0reactions
rosmcmahoncommented, Sep 12, 2022

i must have missed your reply, sorry Piotr. if you must define the return manually, i guess you could also define the interface/type in your code beside it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript "Not a Constructor" Exception while creating objects
Sometimes it is just how you export and import it. For this error message it could be, that the default ...
Read more >
TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >
TypeError: exports.DOMException is not a constructor #1133
Hi @shlaikov, we have investigated this issue and found out that exports.DOMException is not a constructor exception is expected behavior. React ...
Read more >
How to Build an Ethereum Transaction App with React and ...
Now let's install Vite if you have not. yarn create vite # or npm init vite@latest. You will be prompted to enter your...
Read more >
react cannot access context before initialization - You.com
App "; export default class OfferSorting extends React.Component { static contextType = FilterContext; constructor(props) { super(props); } ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found