truffle unbox react, unhandled rejection - reactjs

I keep getting this error
"Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first.
"
when launching truffle unbox react, and also I don't have truffle.js, only have truffle-config.js

Late but hopefully this will answer the question as I have ran into the same issue.
Assuming your metamask extension is enabled, make sure to switch your network to the localhost that is running either ganache-cli or truffle.

Related

Getting More Specific Error Messages For GraphQL in a React App

I'm working on a ReactJS app that has a lot of GraphQL mutations. I was cleaning up some things and fixing up all the files where mutations were housed, and at some point I got hit with this error:
Uncaught GraphQLError: Syntax Error: Expected Name, found "!".
at syntaxError (syntaxError.mjs:8:1)
Now, I know that this must be due to something in the operations.js folder or somewhere in the React App where a mutation / Query with parameters is house, but that error is giving me little to no help tracking it. I've been unable to find where this could be with the naked eye, is there anything I can do to pinpoint where this error is occuring, i.e. getting a more helpful message than the one above?

After running truffle unbox react getting error

After first initialization of running truffle compile then truffle unbox react getting error Unhandled Rejection (Error): This contract object doesn't have address set yet, please set an address first.
I am trying to install a react dapp so i can learn how to create dapps so i am a beginner but i dont understand why i woulg get an error after first initialization. Also when i ran truffle unbox react it didnt complete it stopped at downloading and didnt do anything after that so it did not set up the box. then i tried truffle unbox react, unhandled rejection and that didnt work so i tried https://www.youtube.com/watch?v=X3vdaNY9KYQ and that didnt work either. To explain I went to ganache and settings and changed the port number to 8545 and then connected to local host 8545 in metamask then i changed my hostname to the numbers in node for on your network because the localhost did not work either. The farthest to a difference i got was connecting to my network and now the page is stuck at loading web3,accounts, and contract and a dialog box popped up and gave me this error.
Failed to load web3, accounts, or contract. Check console for details

Getting error : UNHANDLED REJECTION Reducers may not dispatch actions in react gatsby

suddenly it started giving me error : UNHANDLED REJECTION Reducers may not dispatch actions, when i try to run npm start, prior it was working fine for me, but somehow it started to giving me the error, can anyone please help me to resolve this issue, i am using react gatsby
This error can be caused due to a mismatch in your gatsby-config file from what is expected.
For example, if you use SiteMetaData instead of SiteMetadata, it won't show an error while rebuilding, but it can not be validated while re-running the application, and hence it will throw an error.
Refer to this documentation for more details about the config api

React, Firebase Auth error

I have been getting this error when trying to authenticate using firebase with react.
I was able to log in after i updated all the Node_modules, but when i get the logged in user data from firebase i get this error code.
O {code: "auth/argument-error", message: "toJSON failed: First argument must be a valid string."}
I have been creating a file almost identical to this repo.
https://github.com/TaylorRayHoward/ReactReduxMessageBoard/tree/Video2
Even if i run this code, I'm unable to login and i still get the same error.
I have found the solution...
When i was using the redux devtools with google chrome the error came up. Now when i have removed the code from my application, the error does not exist any more.

Catching and handling errors with Apollo Client

I'm trying to handle errors with Apollo in react gracefully. So the idea is whenever the user encounters an error of some sort (500 or anything else). I want to just show a message like 'something went wrong, please try again later'.
Upon the first render of the component this works fine (the error is present in data.error) but when I leave the route and the component is unmounted, it throws.
At the moment I cannot prevent it from throwing an error. I've tried pretty much everything in this thread: https://github.com/apollographql/react-apollo/issues/604#issuecomment-355648596
link-error: Logs the errors, but doesn't prevent it from throwing
hoc: Logs the errors, but doesn't prevent it from throwing
componentDidCatch: Doesn't do anything
errorPolicy: Prevents errors, but it means I also can't handle them anymore.
I always get the following stack:
Unhandled error Network error: Response not successful: Received status code 500 Error: Network error: Response not successful: Received status code 500
at new ApolloError (webpack-internal:///./node_modules/apollo-client/errors/ApolloError.js:36:28)
at eval (webpack-internal:///./node_modules/apollo-client/core/QueryManager.js:287:41)
at eval (webpack-internal:///./node_modules/apollo-client/core/QueryManager.js:668:17)
at Array.forEach (<anonymous>)
at eval (webpack-internal:///./node_modules/apollo-client/core/QueryManager.js:667:18)
at Map.forEach (<anonymous>)
at QueryManager.broadcastQueries (webpack-internal:///./node_modules/apollo-client/core/QueryManager.js:662:22)
at eval (webpack-internal:///./node_modules/apollo-client/core/QueryManager.js:236:31)
at <anonymous>
For reference:
- apollo-client: 2.2.5
- react-apollo: 2.0.4
As described here:
I believe the way to "handle" the error when using the graphql HOC is
to simply check data.errors inside the component. There's a check
inside apollo-client that throws if data.errors isn't accessed.
The whole issue on GitHub where this comment was made has a very interesting discussion about the how's and why's. Most of the proposed solutions didn't work for me, especially the componentDidCatch, which, IMHO, was the cleanest alternative.
I could get over it touching the this.props.data.error, but I'm definitely not happy with it.
Edit
I've just noticed that you mentioned that the errors where happening when the component was unmounting... and well, it seems to be fixed on 2.1.0-beta.3. :-)

Resources