Unhandled Runtime Error
ReactMoralisError: Provide a “appId” provided to
ReactMoralisError: Provide a “appId” provided to
it looks like serverUrl and appId were not set
I did but still doesn’t work
import { MoralisProvider } from “react-moralis”;
import “…/styles/globals.css”;
function MyApp({ Component, pageProps }) {
return (
<MoralisProvider
appId={process.env.NEXT_PUBLIC_APP_ID}
serverUrl={process.env.NEXT_PUBLIC_SERVER_URL}
<Component {...pageProps} />
</MoralisProvider>
);
}
export default MyApp;
try to hardcode them instead of using process.env.NEXT_PUBLIC_APP_ID
I couldn’t use process.env directly inside of MoralisProvider, and had to do it this way.
const appId = process.env.NEXT_PUBLIC_REACT_APP_MORALIS_APP_ID;
const serverUrl = process.env.NEXT_PUBLIC_REACT_APP_MORALIS_SERVER_ID;
<MoralisProvider
appId={appId}
serverUrl={serverUrl}
>
It worked. Thank you so much
as of June 3rd the previous solution doesn’t work as I tried it still giving that same error
Can we see your code? Does hardcoding the appId work?
this is what I had originally
then this is what I have now after reading what others wrote
for some reason nothing is working and I think it has to do with .env because when i put the the secret code in it work perfectly fine. Oh and im also running on latest version moralis
Did you change your .env file to reflect the addition of REACT_APP_
in the second example?
Do you get a valid value if you log appId directly below and reload your app?
const AppId = ...
const serverUrl = ...
console.log("App ID", appId);