# Body: Specified ingress\_expiry not within expected range:

**URL:** <https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015>\
**Category:** Developers\
**Tags:** Discussing\
**Created:** [August 8, 2024, 1:40pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015 "2024-08-08T13:40:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![BustyBeardo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bustybeardo/32/16506_2.png) [@BustyBeardo](https://forum.dfinity.org/u/BustyBeardo)\
**Post date:** [August 8, 2024, 1:40pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/1 "2024-08-08T13:40:53Z")

</div>

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:

```auto
 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:

```auto
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

---

<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:** [August 13, 2024, 9:41am UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/2 "2024-08-13T09:41:21Z")

</div>

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

> [@Agent-js does not work in Next.js SSG](https://forum.dfinity.org/t/agent-js-does-not-work-in-next-js-ssg/34090/4):
>
> I’d use createSync for SSG contexts as the simple fix, but the point is probably more to do with fetch or syncTime not working as intended. I have another reported issue with the syncTime flow, so I’m going to dive into this and get back to you

---

<div class="post-metadata">

**Author:** ![BustyBeardo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bustybeardo/32/16506_2.png) [@BustyBeardo](https://forum.dfinity.org/u/BustyBeardo)\
**Post date:** [September 17, 2024, 1:16pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/4 "2024-09-17T13:16:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bogwar](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bogwar/32/2161_2.png) [@bogwar](https://forum.dfinity.org/u/bogwar)\
**Post date:** [September 17, 2024, 2:03pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/5 "2024-09-17T14:03:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![BustyBeardo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bustybeardo/32/16506_2.png) [@BustyBeardo](https://forum.dfinity.org/u/BustyBeardo)\
**Post date:** [September 18, 2024, 9:54am UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/6 "2024-09-18T09:54:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BustyBeardo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bustybeardo/32/16506_2.png) [@BustyBeardo](https://forum.dfinity.org/u/BustyBeardo)\
**Post date:** [September 18, 2024, 9:59am UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/7 "2024-09-18T09:59:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bogwar](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bogwar/32/2161_2.png) [@bogwar](https://forum.dfinity.org/u/bogwar)\
**Post date:** [September 18, 2024, 3:53pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/8 "2024-09-18T15:53:48Z")

</div>

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 🙂 )

---

<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:** [September 18, 2024, 5:01pm UTC](https://forum.dfinity.org/t/body-specified-ingress-expiry-not-within-expected-range/34015/9 "2024-09-18T17:01:12Z")

</div>

> [@bogwar](#):
>
> Perhaps there’s an option to set the timestamp explicitly?

There is seems last release but, according @anon74414410, if I get it right, it’s not considered as super secure. See this [thread](https://forum.dfinity.org/t/agent-js-2-1-0-is-released/35090/5).

In another [thread](https://forum.dfinity.org/t/agent-js-does-not-work-in-next-js-ssg/34090/4) 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.
