# VITE\_DFX\_NETWORK Incorrect

**URL:** <https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153>\
**Category:** Developers\
**Tags:** Frontend\
**Created:** [November 30, 2023, 4:37am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153 "2023-11-30T04:37:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 4:37am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/1 "2023-11-30T04:37:34Z")

</div>

Hi,

I’ve deployed a new frontend written in svelte but the frontend is trying to call my local canister paths:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/8/8cb7d84bacc498b711a37a2e2b0b6e8c2196dd71.png)

My vite config is here:

> <https://github.com/jamesbeadle/OpenFPL/blob/master/vite.config.ts>

Any help appreciated.

Thanks,  
James

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [November 30, 2023, 5:55am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/2 "2023-11-30T05:55:28Z")

</div>

Debug your app, what `DFX_NETWORK` value do you get there: [https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL\_frontend/src/utils/ActorFactory.ts#L16](https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL_frontend/src/utils/ActorFactory.ts#L16)

Once you know which value you get, debug your configuration to see what `DFX_NETWORK` is set there: [https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/vite.config.ts#L96](https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/vite.config.ts#L96)

Note related to your issue probably but still: I suggest to replace this line [https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL\_frontend/src/utils/ActorFactory.ts#L19](https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL_frontend/src/utils/ActorFactory.ts#L19) with `https://icp-api.io`.

---

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 6:37am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/3 "2023-11-30T06:37:00Z")

</div>

When I debug locally I get ‘local’. I don’t know how to read DFX\_NETWORK from my live frontend.

---

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 6:37am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/4 "2023-11-30T06:37:40Z")

</div>

> [@peterparker](#):
>
> Note related to your issue probably but still: I suggest to replace this line [https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL\_frontend/src/utils/ActorFactory.ts#L19](https://github.com/jamesbeadle/OpenFPL/blob/b99a0a087863b750db16110854767765b58993d9/src/OpenFPL_frontend/src/utils/ActorFactory.ts#L19) with `https://icp-api.io`.

Thank you, I’ve updated it!

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [November 30, 2023, 6:38am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/5 "2023-11-30T06:38:55Z")

</div>

I mean debug your prod build, the one you deploy on mainnet.

---

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 6:44am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/6 "2023-11-30T06:44:21Z")

</div>

Sure but I don’t know how to read DFX\_NETWORK from my production build.

---

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 6:49am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/7 "2023-11-30T06:49:11Z")

</div>

![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/e/e6f4b6077b48389a56cde2c549e6bdaf2b5fd03d.png)  
So in the compiled code it is local.

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [November 30, 2023, 6:50am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/8 "2023-11-30T06:50:08Z")

</div>

> [@jamesbeadle](#):
>
> Sure but I don’t know how to read DFX\_NETWORK from my production build.

You can add a `console.log` and redeploy (it does not work anyway so it won’t arm).

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [November 30, 2023, 6:50am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/9 "2023-11-30T06:50:39Z")

</div>

Then “local” is incorrect. Now next step, debug your vite.config. What do you get there as DFX\_NETWORK when you `npm run build`

---

<div class="post-metadata">

**Author:** ![jamesbeadle](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jamesbeadle/32/10110_2.png) [@jamesbeadle](https://forum.dfinity.org/u/jamesbeadle)\
**Post date:** [November 30, 2023, 7:05am UTC](https://forum.dfinity.org/t/vite-dfx-network-incorrect/25153/10 "2023-11-30T07:05:19Z")

</div>

Ok it was the adapter, I changed it from static to auto when I implemented the custom tailwind config as per their docs.

Changing it back works, will need to see if it has effected the tailwind implementation.

Thanks for your help.
