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

**URL:** <https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621>\
**Category:** Developers\
**Created:** [June 1, 2021, 1:31pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621 "2021-06-01T13:31:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayazgv](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ayazgv/32/1587_2.png) [@ayazgv](https://forum.dfinity.org/u/ayazgv)\
**Post date:** [June 1, 2021, 1:31pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621/1 "2021-06-01T13:31:47Z")

</div>

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

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

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

```

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

> <https://github.com/ic-cubes/ic-tools/blob/main/pages/account/%5BaccountId%5D.tsx>

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [June 1, 2021, 2:02pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621/2 "2021-06-01T14:02:56Z")

</div>

What does `console.log(deployerIDL)` return?

---

<div class="post-metadata">

**Author:** ![ayazgv](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ayazgv/32/1587_2.png) [@ayazgv](https://forum.dfinity.org/u/ayazgv)\
**Post date:** [June 1, 2021, 2:06pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621/3 "2021-06-01T14:06:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/wang/32/446_2.png) [@wang](https://forum.dfinity.org/u/wang)\
**Post date:** [June 1, 2021, 2:13pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621/4 "2021-06-01T14:13:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ayazgv](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ayazgv/32/1587_2.png) [@ayazgv](https://forum.dfinity.org/u/ayazgv)\
**Post date:** [June 1, 2021, 2:15pm UTC](https://forum.dfinity.org/t/getting-error-when-i-try-to-access-to-a-canister-from-react-app-with-dfinity-agent-package/4621/5 "2021-06-01T14:15:21Z")

</div>

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!
