Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 11 additions & 6 deletions pages/serverless-containers/how-to/test-a-container.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import Requirements from '@macros/iam/requirements.mdx'

This page shows you how to execute Serverless Containers from the [Scaleway console](https://console.scaleway.com). The **Test** feature of a container allows you to run your code using a selection of methods to make sure it behaves as expected.

<Message type="note">
Testing **Private** Serverless Functions is not possible using the Scaleway console due to CORS limitations. Refer to the [dedicated documentation](/serverless-containers/how-to/create-auth-token-from-console/) for more information on how to secure and test a private function.
</Message>

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
Expand All @@ -35,9 +31,18 @@ Testing **Private** Serverless Functions is not possible using the Scaleway cons

7. Click **+ Advanced options** to add any required HTTP header or parameter to your container.

8. Click **Run**.
8. Copy the generated command, then execute it in a terminal.

<Message type="note">
Testing a private container requires you use an [authentication token](/serverless-containers/how-to/create-auth-token-from-console/) as a header, as shown below:

```bash
export $TOKEN=<YOUR_AUTH_TOKEN>
curl -H "X-Auth-Token: $TOKEN" \ <YOUR_FUNCTION_ENDPOINT>
````
</Message>

The **Output** section displays the response from your container and the status code.
The output of your terminal displays the response from your container, and the status code.

<Message type="note">
If you encounter a message error while testing your container, refer to the [dedicated troubleshooting](/serverless-containers/troubleshooting/tests-fail-on-container/) for more information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ I get error messages when testing Serverless Containers using the Scaleway Conso

## Cause

Testing **Private** Serverless Containers is not possible using the Scaleway console due to CORS limitations.
**Private** Serverless Containers require you use an authentication token.

## Possible solutions

- Change the visibility of your function to **public**. Public containers can be executed anonymously.

- Make sure you have created an [authentication token](/serverless-containers/how-to/create-auth-token-from-console/) for your private function, then execute a `curl` request from a terminal, as shown below:
```bash
curl -H "X-Auth-Token: <YOUR_AUTH_TOKEN>" \ <YOUR_CONTAINER_ENDPOINT>
export $TOKEN=<YOUR_AUTH_TOKEN>
curl -H "X-Auth-Token: $TOKEN" \ <YOUR_CONTAINER_ENDPOINT>
```
17 changes: 11 additions & 6 deletions pages/serverless-functions/how-to/test-a-function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import Requirements from '@macros/iam/requirements.mdx'

This page shows you how to execute Serverless Functions from the [Scaleway console](https://console.scaleway.com). The **Test** feature of a function allows you to run your code using a selection of methods to make sure it behaves as expected.

<Message type="note">
Testing **Private** Serverless Functions is not possible using the Scaleway console due to CORS limitations. Refer to the [dedicated documentation](/serverless-functions/how-to/create-auth-token-from-console/) for more information on how to secure and test a private function.
</Message>

<Requirements />

- A Scaleway account logged into the [console](https://console.scaleway.com)
Expand All @@ -35,9 +31,18 @@ Testing **Private** Serverless Functions is not possible using the Scaleway cons

7. Click **+ Advanced options** to add any required HTTP header or parameter to your function.

8. Click **Run**.
8. Copy the generated command, then execute it in a terminal.

<Message type="note">
Testing a private function requires you use an [authentication token](/serverless-functions/how-to/create-auth-token-from-console/) as a header, as shown below:

```bash
export $TOKEN=<YOUR_AUTH_TOKEN>
curl -H "X-Auth-Token: $TOKEN" \ <YOUR_FUNCTION_ENDPOINT>
````
</Message>

The **Output** section displays the response from your function and the status code.
The output of your terminal displays the response from your function, and the status code.

<Message type="note">
If you encounter a message error while testing your function, refer to the [dedicated troubleshooting](/serverless-functions/troubleshooting/tests-fail-on-function/) for more information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ I get error messages when testing Serverless Functions using the Scaleway Consol

## Cause

Testing **Private** Serverless Functions is not possible using the Scaleway console due to CORS limitations.
**Private** Serverless Functions require you use an authentication token.

## Possible solutions

- Change the visibility of your function to **public**. Public functions can be executed anonymously.

- Make sure you have created an [authentication token](/serverless-functions/how-to/create-auth-token-from-console/) for your private function, then execute a `curl` request from a terminal, as shown below:
```bash
curl -H "X-Auth-Token: <YOUR_AUTH_TOKEN>" \ <YOUR_FUNCTION_ENDPOINT>
export $TOKEN=<YOUR_AUTH_TOKEN>
curl -H "X-Auth-Token: $TOKEN" \ <YOUR_FUNCTION_ENDPOINT>
```