`transactionExports is not a constructor` - vite-react project
See original GitHub issueHey 😃 One of the projects using Warp SDK reported a bug in their vite-react project (it appears only on production, dev is ok).
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:
- Created a year ago
- Comments:12 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 😃
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?