Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(serverless): 502 errors #4170

Merged
merged 6 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions serverless/containers/how-to/add-trigger-to-a-container.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ The configuration of the queue retention can affect the behavior of the trigger.

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.

<Message type="note">
**Retry Policy:** If the Container returns a status code >=3XX, sending the message will be retried up to three times.
</Message>

## NATS triggers

[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.
Expand All @@ -69,6 +73,10 @@ When a message is pushed to the selected queues, the container will be triggered
6. Enter a **name** for your trigger and select the **NATS (Scaleway)** type, then select your NATS account and subject name.
7. Click **Create trigger** to launch the trigger creation.

<Message type="note">
**Retry Policy:** If the Container returns a status code >=3XX, sending the message will be retried up to three times.
</Message>

## CRON triggers

[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.
Expand Down
49 changes: 49 additions & 0 deletions serverless/containers/troubleshooting/502-error-when-scaling.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
meta:
title: Error code 502
description: Troubleshoot 502 issues while sending requests to Serverless Containers.
content:
h1: Error code 502
paragraph: Troubleshoot 502 issues while sending requests to Serverless Containers.
tags: serverless Containers troubleshooting issue error 502
dates:
validation: 2025-01-03
posted: 2025-01-03
categories:
- serverless
---

## Problem

502 errors can sometimes occur on Serverless Containers during the autoscaling process when new container instances are being created.

### Cause

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.

This issue typically occurs when traffic is sent too early to the newly created container before it is fully deployed.

### Possible solutions

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**.

**Custom health checks** can be configured via the API; in this case, it's recommended to implement a custom HTTP route on the Container that returns its readiness status.

* [API Documentation for custom health checks](https://www.scaleway.com/en/developers/api/serverless-containers/#path-containers-update-an-existing-container) - Refer to the `health_check` parameter.

<Message type="tip">
A simple health check to implement is just a simple `GET` on `/` to make sure the HTTP server is properly listening.

Example (incomplete) settings:
```
health_check: {
http: {
path: "/"
}
}
```
</Message>

<Message type="note">
The custom health check feature will be available in the Scaleway console in Q1 2025.
</Message>
8 changes: 8 additions & 0 deletions serverless/functions/how-to/add-trigger-to-a-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ The configuration of the queue retention may affect the behavior of the trigger.
6. Enter a **name** for your trigger and select the **Queues (Scaleway)** type, then select your queue name.
7. Click **Create trigger** to launch trigger creation.

<Message type="note">
**Retry Policy:** If the Function returns a status code >=3XX, sending the message will be retried up to three times.
</Message>

## NATS triggers

[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.
Expand All @@ -67,6 +71,10 @@ Scaleway [NATS subjects](/serverless/messaging/quickstart/#quickstart-for-nats)
6. Enter a **name** for your trigger and select the **NATS (Scaleway)** type, then select your NATS account and subject name.
7. Click **Create trigger** to launch trigger creation.

<Message type="note">
**Retry Policy:** If the Function returns a status code >=3XX, sending the message will be retried up to three times.
</Message>

## CRON triggers

[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.
Expand Down
Loading