Getting error when I try to access to a canister from react app with @dfinity/agent package

Hello everybody!

When I try to access to a canister like below, then I’m getting a type error:
TypeError: interfaceFactory is not a function

import { Actor, HttpAgent } from "@dfinity/agent";
import deployerIDL from "../../Deployer/Deployer.did";

const agent = new HttpAgent();
const deployer = Actor.createActor(   // <- error shows this line
        canisterId: "rrkah-fqaaa-aaaaa-aaaaq-cai",

In this case the question is: why it works within this repository, not works within mine repo?

What does console.log(deployerIDL) return?

It returns: /static/media/Deployer.93b24ad9.did

Do you have a Deployer.did.js file with the JS bindings? Are you using webpack?

1 Like

Yes, I have Deployer.did.js, no I’m using @craco
I edited the end of line with .js at line 2, and it worked!