# La posta in arrivo non è più gestita a causa di una chiave API non valida

**URL:** <https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706>\
**Category:** Support\
**Created:** [17 Maggio 2018, 5:16am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706 "2018-05-17T05:16:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 5:16am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/1 "2018-05-17T05:16:20Z")

</div>

I just realised that I’m no longer seeing any bounces being handled. When checking my mail log, I see the following line for each incoming email:

> Failed to POST the e-mail to [https://blenderartists.org/admin/email/handle\_mail:](https://blenderartists.org/admin/email/handle_mail:) 404

This has been going on for 4 days. I just did a rebuild to latest and I see the same thing happening.

---

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [17 Maggio 2018, 5:29am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/2 "2018-05-17T05:29:37Z")

</div>

What changed four days ago? What do the app logs say?

---

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 5:30am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/3 "2018-05-17T05:30:22Z")

</div>

I then did a rebuild also. It just seems like that /admin/email/handle\_email route is gone - I can’t access it from a browser either.

Edit: hang on, I missed your question about app logs. Will dig that up now.

---

<div class="post-metadata">

**Author:** ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)\
**Post date:** [17 Maggio 2018, 5:32am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/4 "2018-05-17T05:32:26Z")

</div>

> [@bartv](#):
>
> I can’t access it from a browser either.

Could you access it from a browser before?

---

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 5:36am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/5 "2018-05-17T05:36:08Z")

</div>

Ah that was useful. Apparently nginx is rate-limiting my own IP address:

```plaintext
2018/05/17 04:48:41 [error] 312#312: *5257301 limiting requests, excess: 100.873 by zone "bot", client: xxxxx, server: _, request: "POST /admin/email/handle_mail?api_key=xxxxx&api_username=system HTTP/1.1", host: "blenderartists.org"

```

This is uncharted area for me; any thoughts on how I can fix this?

---

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 6:29am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/6 "2018-05-17T06:29:13Z")

</div>

Looking a little deeper, I also see this in production.log:

```plaintext
Started POST "/admin/email/handle_mail?api_key=[FILTERED]&api_username=system" for xxx at 2018-05-17 05:57:37 +0000
ActionController::RoutingError (No route matches [POST] "/admin/email/handle_mail")

```

Perhaps the rate-limiting was a secondary effect of a missing route, causing many retries?

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [17 Maggio 2018, 7:08am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/7 "2018-05-17T07:08:58Z")

</div>

Pretty sure that route is still there. We use it here on meta and receive lots of ✉ every day.

---

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 7:20am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/8 "2018-05-17T07:20:58Z")

</div>

Gotcha. Is there a way to print the active routes? I do still see handle\_email in config/routes.db, but I’m not sure where to do from there to debug this.

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [17 Maggio 2018, 7:28am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/9 "2018-05-17T07:28:20Z")

</div>

Is your API key properly working? You might get a 404 because the request isn’t being authenticated to an admin account?

---

<div class="post-metadata">

**Author:** ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)\
**Post date:** [17 Maggio 2018, 7:34am UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/10 "2018-05-17T07:34:00Z")

</div>

YES! That was it! My API key had disappeared from the admin, very strange.

Thanks for your help Régis!

And for what it’s worth, wouldn’t an ‘401 unauthorized’ response be better in this case than a ‘404 not found’?

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [8 Giugno 2024, 12:37pm UTC](https://meta.discourse.org/t/inbound-mail-is-not-handled-anymore-due-to-invalid-api-key/87706/11 "2024-06-08T12:37:28Z")

</div>

Questo argomento è stato chiuso automaticamente dopo 2214 giorni. Non sono più consentite nuove risposte.
