Body: Specified ingress_expiry not within expected range:

I am running a heroku server and trying to talk to a canister on mainnet.

I am encountering an error quite frequently where I am being told that my time is ahead of the IC network and I am before time expiry. This is the full error I am seeing:

 Body: Specified ingress_expiry not within expected range: 
Minimum allowed expiry: 2024-08-08 12:06:05.276014545 UTC, 
Maximum allowed expiry: 2024-08-08 12:11:35.276014545 UTC, 
Provided expiry:        2024-08-08 12:06:00 UTC

I have looked into changing the time/resyncing the time of my heroku server but it seems to be correct and uses AWS to sync the time. So it is likely that my server time is correct.

I have tried using the syncTime function on the agent i am trying to use but it doesn’t seem to change anything.

this is a snippet of my code:

export const createAgent = async (canisterID: string) => {
  const agent = new HttpAgent({
    host: 'https://ic0.app',
    identity,
  });
  agent.syncTime(Principal.fromText(canisterID));

Is it possible that the IC’s time is a little bit behind? Or is there anything I can do to fix this…

Please help x

Not the same error message but, it sounds vaguely similar to the SSG issue I encountered this weekend. @kpeacock said there might be an inssue with syncTime:

I take it back this error still keeps appearing can someone please offer a decent solution :cry:

The IC seems to be a bit ahead by 6 seconds or so. IIRC, the provided timestamp in the ingress cannot be in the past but can be (up to 5mins) in the future.
Perhaps shift the timestamp in the ingress message by, say, 30secs into the future?

Yeah I did think about that and how i could do it but do you have any idea how I do that in javascript?

Yeah I did think about that and how i could do it but do you have any idea how I do that in javascript?

Unfortunately I am not familiar with the js agent (which is probably what you use to create the transactions). Perhaps there’s an option to set the timestamp explicitly? I think in the Rust version of the agent that is possible (but i’m not familiar with that one either :slight_smile: )

There is seems last release but, according @kpeacock, if I get it right, it’s not considered as super secure. See this thread.

In another thread they recommended to try to use createSync for SSG, so maybe that’s something which might be worth a try.

There are various threads currently open on the forum regarding this issue, I guess it’s still an on-going effort.

1 Like