# Ingress\_expiry not within expected range error

**URL:** https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456
**Category:** Motoko
**Tags:** Functional-Programming, community-consideration, Frontend
**Created:** [September 23, 2024, 1:03pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456 "2024-09-23T13:03:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 23, 2024, 1:03pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/1 "2024-09-23T13:03:28Z")

</div>

hello there,  
ingress\_expiry not within expected error when deploy frontend canister from server ,  
to create static page i sent get data request to node api and node api call my backend canister to fetch data , some pages created and in some pages it throw an error ingress\_expiry not within expected range .

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/a/3/a3f2b59ac0105b8667d1831309ec57c621c35391.png)  
sometime its work well and sometime i face this error .  
And on frontend my website is on article base when i try to publish the the article i face this error  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/f/8/f80f70e21027ccab20a2e81cc20e47f7d747615d.jpeg)  
2 week ago it was working well and now this error is happing.  
and my time is also synced .i hope i will get authenticated solution from definity team.

---

<div class="post-metadata">

### Author: ![dantol29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dantol29/32/20601_2.png) [@dantol29](https://forum.dfinity.org/u/dantol29)
#### Post date: [September 23, 2024, 1:55pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/2 "2024-09-23T13:55:35Z")

</div>

Had the same issue, but in Rust

---

<div class="post-metadata">

### Author: ![jennifertran](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jennifertran/32/11558_2.png) [@jennifertran](https://forum.dfinity.org/u/jennifertran)
#### Post date: [September 23, 2024, 10:52pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/3 "2024-09-23T22:52:42Z")

</div>

This is a potentially known issue. Can you and @dantol29 please let me know what subnet is the canister that you are on?

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 24, 2024, 5:19am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/4 "2024-09-24T05:19:55Z")

</div>

> **[Subnet: 6pbhf-qzpdk-kuqbr-pklfa-5ehhf-jfjps-zsj6q-57nrl-kzhpd-mu7hc-vae](https://dashboard.internetcomputer.org/subnet/6pbhf-qzpdk-kuqbr-pklfa-5ehhf-jfjps-zsj6q-57nrl-kzhpd-mu7hc-vae)**
>
> Application subnet blockchain which hosts canister smart contracts and adds capacity to the Internet Computer.

---

<div class="post-metadata">

### Author: ![jennifertran](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jennifertran/32/11558_2.png) [@jennifertran](https://forum.dfinity.org/u/jennifertran)
#### Post date: [September 24, 2024, 5:27am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/5 "2024-09-24T05:27:54Z")

</div>

In the latest AgentJS release, you can set a specific `replicaTime`. Can you please try that and see if it helps per the other thread that we’re communicating in?

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 24, 2024, 9:21am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/6 "2024-09-24T09:21:15Z")

</div>

i have update its version to latest and and i don;t know to to set its value replicaTime  
i have set it like  
const replicaTime = BigInt(Date.now()) \* BigInt(1\_000\_000); // Current time in nanoseconds

const agent = options.agent || HttpAgent.createSync({ …options.agentOptions ,replicaTime});  
is it correct if not then reffer me how to do this. thanks

---

<div class="post-metadata">

### Author: ![dantol29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dantol29/32/20601_2.png) [@dantol29](https://forum.dfinity.org/u/dantol29)
#### Post date: [September 24, 2024, 6:13pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/7 "2024-09-24T18:13:22Z")

</div>

BOB ledger - [https://dashboard.internetcomputer.org/canister/egjwt-lqaaa-aaaak-qi2aa-cai](https://dashboard.internetcomputer.org/canister/egjwt-lqaaa-aaaak-qi2aa-cai)

---

<div class="post-metadata">

### Author: ![dantol29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dantol29/32/20601_2.png) [@dantol29](https://forum.dfinity.org/u/dantol29)
#### Post date: [September 25, 2024, 9:19am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/9 "2024-09-25T09:19:19Z")

</div>

Solution for those who use rust ic-agent library:

```auto
use time::{Duration, OffsetDateTime};
use ic_agent::Agent;

let now_utc = OffsetDateTime::now_utc();
let five_seconds = Duration::seconds(5);
let time = now_utc + five_seconds;

agent.query(&ledger.id, "get_transactions")
       .expire_at(time)
       .with_arg("your args").unwrap())
       .call_without_verification().await

```

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 25, 2024, 9:41am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/10 "2024-09-25T09:41:03Z")

</div>

how i can did this in next js creating agent please need help @jennifertran  
when i send request to canister it show me error like ingress expiry screenshot i mentioned above

---

<div class="post-metadata">

### Author: ![dantol29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dantol29/32/20601_2.png) [@dantol29](https://forum.dfinity.org/u/dantol29)
#### Post date: [September 25, 2024, 9:48am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/11 "2024-09-25T09:48:39Z")

</div>

[https://github.com/search?q=repo%3Adappblock%2Fnextjs-ic-starter%20agent&type=code](https://github.com/search?q=repo%3Adappblock%2Fnextjs-ic-starter%20agent&type=code)

---

<div class="post-metadata">

### Author: ![Ray04](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/ray04/32/24164_2.png) [@Ray04](https://forum.dfinity.org/u/Ray04)
#### Post date: [September 25, 2024, 10:06am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/12 "2024-09-25T10:06:16Z")

</div>

Had this weird error also in a project I worked on, had this when one of my team member has deployed the project on main net and while testing on main net, rust backend and react front end.  
This was the issue, Some on the internet said that the system time might be wrong. Which we checked later on, and seemed to be correct.

Ultimately, we resolved the error by deploying again on main net in my laptop, and it worked perfectly. So, I’d suggest you to do that. Not another laptop, but prolly just deploying again on the main net.

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 25, 2024, 11:10am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/13 "2024-09-25T11:10:18Z")

</div>

which canisiter i deploy now i send a request to backend canister which throw an error “ingress expiry” ,  
is this reason can be i am send to many request to backend ? as i am creating build of nextjs and static pages and for each static page a create an actor and an send request to backend to get data? if anyone the reason than please let me know. thanks

---

<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: [September 25, 2024, 11:39am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/14 "2024-09-25T11:39:06Z")

</div>

Hi @jennifertran,

We have the same problem periodically, affecting network calls that require user to be authenticated.

Is there a fix?

Thanks,  
James

---

<div class="post-metadata">

### Author: ![YAP](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/yap/32/33025_2.png) [@YAP](https://forum.dfinity.org/u/YAP)
#### Post date: [September 25, 2024, 4:48pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/15 "2024-09-25T16:48:35Z")

</div>

Dear Alishan and James

The root of the problem you encountered is the fact that a client’s time can be ahead of the replica’s time which receives the message. Moreover the time certified by the subnet’s nodes can differ from both those times as well. We are aware of the problem and we’re discussing different options to improve the situation. We should be able to communicate a more concrete plan soon.

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 25, 2024, 5:04pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/16 "2024-09-25T17:04:09Z")

</div>

Thanks @yvonneanne for your response. How i can make client time ahead ? Suggest be best solution because my project is live.

---

<div class="post-metadata">

### Author: ![TusharGuptaMm](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tusharguptamm/32/11944_2.png) [@TusharGuptaMm](https://forum.dfinity.org/u/TusharGuptaMm)
#### Post date: [September 25, 2024, 5:16pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/17 "2024-09-25T17:16:38Z")

</div>

We’ve been encountering this issue quite often as well whenever we do Update calls. We’re using Motoko for our canisters.

`Specified ingress_expiry not within expected range: Minimum allowed expiry: 2024-09-25 16:20:14.229894131 UTC, Maximum allowed expiry: 2024-09-25 16:25:44.229894131 UTC, Provided expiry: 2024-09-25 16:20:00 UTC`

---

<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: [September 25, 2024, 5:26pm UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/18 "2024-09-25T17:26:13Z")

</div>

Yeah a work around would be good for now

---

<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: [September 26, 2024, 2:22am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/19 "2024-09-26T02:22:18Z")

</div>

So I deploy and it’s fine for a moment but then a few minutes later it is out of sync.

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

---

<div class="post-metadata">

### Author: ![Alishan](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Alishan](https://forum.dfinity.org/u/Alishan)
#### Post date: [September 26, 2024, 3:42am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/20 "2024-09-26T03:42:15Z")

</div>

I think it’s not from our end its from ICP. @YAP

---

<div class="post-metadata">

### Author: ![TusharGuptaMm](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/tusharguptamm/32/11944_2.png) [@TusharGuptaMm](https://forum.dfinity.org/u/TusharGuptaMm)
#### Post date: [September 26, 2024, 5:30am UTC](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456/21 "2024-09-26T05:30:12Z")

</div>

This issue might be subnet-specific, though it’s just a guess—it could be related to the V3 release aimed at [reducing end-to-end latencies](https://forum.dfinity.org/t/reducing-end-to-end-latencies-on-the-internet-computer/34383) ?

[Next page](https://forum.dfinity.org/t/ingress-expiry-not-within-expected-range-error/35456.md?page=2)
