I previously was able to access my frontend. However, after running npm run build
, then dfx build
, and dfx deploy
again, I navigate to the local frontend and receive this error in my console:
main.fb581454.js:2 Uncaught Error: Canister ID is required, but recieved undefined instead. If you are using automatically generated declarations, this may be because your application is not setting the canister ID in process.env correctly.
I am able to access my backend Candid UI.
I confirmed that I do have a .env file with the corresponding canister ids:
# DFX CANISTER ENVIRONMENT VARIABLES
DFX_VERSION='0.14.3'
DFX_NETWORK='local'
APP_CANISTER_ID='bbbbb-4maaa-aaaaa-qaagq-cai'
CANISTER_ID_APP='bbbbb-4maaa-aaaaa-qaagq-cai'
CANISTER_ID_onchainvoting='aovwi-4maaa-aaaaa-qaagq-cai'
BACKEND_CANISTER_ID='ddddd-ruaaa-aaaaa-qaaga-cai'
CANISTER_ID_BACKEND='ddddd-ruaaa-aaaaa-qaaga-cai'
CANISTER_ID_backend='ddddd-ruaaa-aaaaa-qaaga-cai'
CANISTER_ID='ddddd-ruaaa-aaaaa-qaaga-cai'
CANISTER_CANDID_PATH='/Users/princess/Documents/app/src/backend/backend.did'
# END DFX CANISTER ENVIRONMENT VARIABLES
Here is my dfx:
{
"canisters": {
"backend": {
"candid": "src/backend/backend.did",
"package": "backend",
"type": "rust"
},
"app": {
"frontend": {
"dependencies": "backend",
"entrypoint": "src/index.tsx"
},
"source": ["build"],
"type": "assets"
}
},
"output_env_file": ".env"
}
What could I be doing wrong?