Icfront bug with actors making calls?

i’m trying to use icfront with a website that uses actor’s to make call to other canisters, but i always get the following console error and have no idea how to troubleshoot this.

i tried using the newer service worker from the ic repo, but that didn’t work either, it always complained that it couldn’t find the sw.js file on the server, even though it’s present.

can @jplevyak or @ali.piccioni maybe update the icfront repo to work with actors that make calls to other canisters as well or give me a hint on how to do that? tagging @diegop for visibility

1 Like

The problem is that by default the application will attempt to contact the source domain to route API calls, but that domain can’t do that (as it is only sending back the icfront service worker).

Please see the section: GitHub - dfinity/icfront

TL:DR

You need to use createActor(canisterId, { agentOptions: { host: "https://ic0.app" } in your front end to hardcode the production backend when creating agents to make API calls.

3 Likes

hey,
thanks so much for the reply! that did the trick. i was using the host option for all the actors except one that was hidden deep in the store.

Is there another trick to get the newer service worker from the ic repo working? It always complains that it can’t find the sw.js file on the server, but it’s there :thinking: