maxwellfortney / next-candy-machine

Simplified NextJs with typescript example app integrated with Metaplex's Candy Machine
MIT License
123 stars 116 forks source link

Invalid URL error when connecting to localhost:3000 on spun up candy machine #14

Closed Swertin closed 2 years ago

Swertin commented 2 years ago

Terminal Output: $ next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Loaded env from C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.env.local info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 info - automatically enabled Fast Refresh for 1 custom loader event - compiled successfully event - build page: / wait - compiling... event - compiled successfully undefined event - build page: /next/dist/pages/_error wait - compiling... event - compiled successfully undefined TypeError [ERR_INVALID_URL]: Invalid URL at new NodeError (node:internal/errors:371:5) at onParseError (node:internal/url:552:9) at new URL (node:internal/url:628:5) at new Connection (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine\node_modules\@solana\web3.js\lib\index.cjs.js:3504:15) at Object../hooks/useWalletBalance.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:37:20) at webpack_require__ (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at Object../pages/_app.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:222:81) at webpack_require (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at webpack_exec (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1329:39) at C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1330:28 { input: 'undefined', code: 'ERR_INVALID_URL' } info - automatically enabled Fast Refresh for 1 custom loader error - TypeError [ERR_INVALID_URL]: Invalid URL at new NodeError (node:internal/errors:371:5) at onParseError (node:internal/url:552:9) at new URL (node:internal/url:628:5) at new Connection (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine\node_modules\@solana\web3.js\lib\index.cjs.js:3504:15) at Object../hooks/useWalletBalance.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:37:20) at webpack_require (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at Object../pages/_app.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:222:81) at webpack_require (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at webpack_exec (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1329:39) at C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1330:28 { input: 'undefined', code: 'ERR_INVALID_URL', page: '/' } undefined TypeError [ERR_INVALID_URL]: Invalid URL at new NodeError (node:internal/errors:371:5) at onParseError (node:internal/url:552:9) at new URL (node:internal/url:628:5) at new Connection (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine\node_modules\@solana\web3.js\lib\index.cjs.js:3504:15) at Object../hooks/useWalletBalance.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:37:20) at webpack_require (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at Object../pages/_app.tsx (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:222:81) at webpack_require (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\webpack-runtime.js:25:42) at webpack_exec__ (C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1329:39) at C:\Users\swert\OneDrive\Desktop\Solana\next-candy-machine.next\server\pages_app.js:1330:28 { input: 'undefined', code: 'ERR_INVALID_URL' }

maxwellfortney commented 2 years ago

Your rpc url is undefined in your .env.local

Swertin commented 2 years ago

@maxwellfortney Not the case, here is my .env.local: REACT_APP_CANDY_MACHINE_CONFIG=9hVmrLSokvR3KvE8Dypfm34qWThEwu4HxCsGpofxrvRw REACT_APP_CANDY_MACHINE_ID=BCanRDVvogfKNS4WBW5vCk7omhYCPjqQLM9pqkEoYKjy REACT_APP_TREASURY_ADDRESS=HsYv8LFEqsA9SChspR6B2DpND7mqVS5GRqmzHRiKNo7p REACT_APP_CANDY_START_DATE=1637179200

REACT_APP_SOLANA_NETWORK=mainnet-beta REACT_APP_SOLANA_RPC_HOST=https://explorer-api.mainnet-beta.solana.com/

Spins up just fine with the normal candy-machine-mint, just fails once I try to visit localhost:3000 after spinning the next candy machine up

Swertin commented 2 years ago

thought it may have been a problem with the backslash, maybe it was appending 2 backslashes, but removing it had no effect. Also tried to spin up on an ubuntu 18.04LTS machine, same error

maxwellfortney commented 2 years ago

All of your items are incorrect. Please follow the .env.template

Swertin commented 2 years ago

DOH! I'm braindead, thought it followed the same .env format. Thank you for your time