1

serverError: TypeError: Referrer "client" is not a valid URL. at new Request (node:internal/deps/undici/undici:5361:21) at R (D:\BIT\tesst\tesst\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:342709)
... 30 lines matching cause stack trace ... at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

can you help me fix this problem, i try to call API Alchemy from component like this

    import { Alchemy, Network } from "alchemy-sdk";
    const settings = {
      apiKey: "key key", // i hide my key
      network: Network.ETH_MAINNET, 
    };
    function App() {
      const alchemy = new Alchemy(settings);

      useEffect(() => {
        const func = async () => {
          return await alchemy.core.getTokenBalances('0x2EeEa57cD51DF77163Fae7A056053f402d8E17CB');
        };

        func().then((r) => console.log("💕", r));
      }, []);
      return (
        <>
          <div></div>
        </>
      );
    }

and it works

but i call it by server nextjs 14, it has problem like title

1
  • Did you figure it out? It would be helpful if you posted your own answer Commented Jun 8, 2024 at 13:31

1 Answer 1

4

You can fix this bug (reported on alchemy sdk github repo: https://github.com/alchemyplatform/alchemy-sdk-js/issues/400) by updating your @alchemy-sdk package to the latest version and adding the connectionInfoOvverides key to your setting object:

const settings = {
   apiKey: "key key", // i hide my key
   network: Network.ETH_MAINNET, 
   connectionInfoOverrides: {
     skipFetchSetup: true,
   },
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.