Skip to content

Commit 0955b64

Browse files
thomas-tacquetbene2k1SamyOubouaziz
authored
feat(serverless): 502 errors (#4170)
* feat(serverless): 502 errors * Apply suggestions from code review Co-authored-by: Benedikt Rollik <[email protected]> * fix(docs): doc review * fix(docs): doc review * fix(docs): doc review * fix(docs): doc review --------- Co-authored-by: Benedikt Rollik <[email protected]> Co-authored-by: SamyOubouaziz <[email protected]>
1 parent c3dde8d commit 0955b64

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

serverless/containers/how-to/add-trigger-to-a-container.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ The configuration of the queue retention can affect the behavior of the trigger.
5555

5656
When a message is pushed to the selected queues, the container will be triggered with the message content passed in the event object's body.
5757

58+
<Message type="note">
59+
**Retry Policy:** If the Container returns a status code superior or equal to 300, sending the message will be retried up to three times.
60+
</Message>
61+
5862
## NATS triggers
5963

6064
[NATS triggers](/serverless/containers/concepts/#nats-trigger) allow you to automatically invoke a container using messages sent in a [NATS](/serverless/messaging/concepts/#nats) subject.
@@ -69,6 +73,10 @@ When a message is pushed to the selected queues, the container will be triggered
6973
6. Enter a **name** for your trigger and select the **NATS (Scaleway)** type, then select your NATS account and subject name.
7074
7. Click **Create trigger** to launch the trigger creation.
7175

76+
<Message type="note">
77+
**Retry Policy:** If the Container returns a status code superior or equal to 300, sending the message will be retried up to three times.
78+
</Message>
79+
7280
## CRON triggers
7381

7482
[CRON triggers](/serverless/containers/concepts/#cron-trigger) allow you to invoke your containers based on a recurring schedule. The CRON triggers for Serverless Containers use the **UTC** time zone.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
meta:
3+
title: Error code 502
4+
description: Troubleshoot 502 error codes while sending requests to Serverless Containers.
5+
content:
6+
h1: Error code 502
7+
paragraph: Troubleshoot 502 error codes while sending requests to Serverless Containers.
8+
tags: serverless Containers troubleshooting issue error 502
9+
dates:
10+
validation: 2025-01-03
11+
posted: 2025-01-03
12+
categories:
13+
- serverless
14+
---
15+
16+
## Problem
17+
18+
502 errors can sometimes occur on Serverless Containers during the autoscaling process when new container instances are being created.
19+
20+
### Cause
21+
22+
When a new instance is created, the Serverless health check verification is performed by default on the HTTP port. Once the port is opened, the resource is considered ready, and traffic starts being forwarded to it.
23+
24+
This issue typically occurs when traffic is sent too early to the newly created container before it is fully deployed.
25+
26+
### Possible solutions
27+
28+
To ensure the Serverless Container is completely ready, both in terms of the HTTP port and the software scope, it is recommended to use **custom health checks**.
29+
30+
You can configure [Custom health checks via the Scaleway API](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) with the `health_check` parameter. In this case, we recommend you implement a custom HTTP route on the Container that returns its readiness status.
31+
32+
<Message type="tip">
33+
A simple health check to implement is just a simple `GET` on `/` to make sure the HTTP server is properly listening.
34+
35+
Example (incomplete) settings:
36+
```
37+
health_check: {
38+
http: {
39+
path: "/"
40+
}
41+
}
42+
```
43+
</Message>
44+
45+
<Message type="note">
46+
Custom healthcheck feature will be available in the Scaleway console for Q1 2025.
47+
</Message>

serverless/functions/how-to/add-trigger-to-a-function.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ The configuration of the queue retention may affect the behavior of the trigger.
5353
6. Enter a **name** for your trigger and select the **Queues (Scaleway)** type, then select your queue name.
5454
7. Click **Create trigger** to launch trigger creation.
5555

56+
<Message type="note">
57+
**Retry Policy:** If the Function returns a status code superior or equal to 300, sending the message will be retried up to three times.
58+
</Message>
59+
5660
## NATS triggers
5761

5862
[NATS triggers](/serverless/functions/concepts/#nats-trigger) allow you to automatically invoke a function using messages sent in a [NATS](/serverless/messaging/concepts/#nats) subject.
@@ -67,6 +71,10 @@ Scaleway [NATS subjects](/serverless/messaging/quickstart/#quickstart-for-nats)
6771
6. Enter a **name** for your trigger and select the **NATS (Scaleway)** type, then select your NATS account and subject name.
6872
7. Click **Create trigger** to launch trigger creation.
6973

74+
<Message type="note">
75+
**Retry Policy:** If the Function returns a status code superior or equal to 300, sending the message will be retried up to three times.
76+
</Message>
77+
7078
## CRON triggers
7179

7280
[CRON triggers](/serverless/functions/concepts/#cron-trigger) allow you to invoke your functions based on a recurring schedule. The CRON triggers for Serverless Functions use the **UTC** time zone.

0 commit comments

Comments
 (0)