Next.js Setting up Authentication


I’m trying to set up the Authentication in the Flow-Quick Start tutorial however, whenever I click the sign-up or log in buttons I receive an error TypeError: Failed to construct 'URL': Invalid URL I have a next.config.cjs and .env.local file in my root directory with the same snippets from the tutorial. Any idea what i’m missing? Thanks

I create a public repo on github incase someone would like more information. Appreciate any help! Thanks GitHub - IbrahimSam96/Collect: Flow BlockChain Quick Start Tutorial

Hi @Phenomenon , I was also facing the same issue. I was able to resolve it. Just check that your config file is inside the ‘src’ of your frontend app and the .env file outside the ‘src’ folder. This worked for me. Hope it helps!


Hi @Phenomenon, did you solve at the end? Even with the @Kartik clue, I’m still getting that issue on the standard nextjs setup. My config.js is on the /src folder while .env.local in the root and index.js in /pages

1 Like

@Phenomenon @Kartik i found the solution if you guys still need it

  1. uninstall dotenv npm install dotenv
  2. add NEXT_PUBLIC_ to each env variable.
    This should fix the problem