Skip to content

Commit 48b4252

Browse files
committed
chore(gen): update
1 parent a428b30 commit 48b4252

File tree

6 files changed

+104
-104
lines changed

6 files changed

+104
-104
lines changed

pages/serverless-functions/reference-content/code-examples.mdx

Lines changed: 99 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Code examples for Serverless Functions
33
description: Explore code examples for creating and deploying Serverless Functions in Scaleway.
44
tags: functions serverless serverless-functions
55
dates:
6-
validation: 2025-02-27
6+
validation: 2025-09-02
77
posted: 2021-10-18
88
---
99
import Requirements from '@macros/iam/requirements.mdx'
@@ -107,7 +107,7 @@ def handle(event, context):
107107

108108
Example of reading URL parameters:
109109

110-
```
110+
```sh
111111
curl https://myfunc/user/?id=1
112112
```
113113

@@ -212,110 +212,111 @@ There are multiple ways a response can return from a handler function:
212212

213213
- With body and statusCode. This response type sets the status code as `HTTP Response Code`, and body as the response's body, headers as `Headers`.
214214

215-
**Stringified *body* (like `AWS Lambda`):**
215+
**Stringified *body* (like `AWS Lambda`):**
216216

217-
```js
218-
module.exports.myHandler = (event, context, callback) => {
219-
return {
220-
statusCode: 201,
221-
body: JSON.stringify({
222-
message: "async function",
223-
}),
224-
headers: {
225-
"Content-Type": "application/json",
226-
},
227-
}
228-
}
229-
```
217+
```js
218+
module.exports.myHandler = (event, context, callback) => {
219+
return {
220+
statusCode: 201,
221+
body: JSON.stringify({
222+
message: "async function",
223+
}),
224+
headers: {
225+
"Content-Type": "application/json",
226+
},
227+
}
228+
}
229+
```
230230

231-
***Not* Stringified **body** (like `AWS Lambda`):**
231+
***Not* Stringified **body** (like `AWS Lambda`):**
232232

233-
```js
234-
module.exports.myHandler = (event, context, callback) => {
235-
return {
236-
statusCode: 201,
237-
body: {
238-
message: "async function",
239-
},
240-
headers: {
241-
"Content-Type": "application/json",
242-
},
243-
}
244-
}
245-
```
233+
```js
234+
module.exports.myHandler = (event, context, callback) => {
235+
return {
236+
statusCode: 201,
237+
body: {
238+
message: "async function",
239+
},
240+
headers: {
241+
"Content-Type": "application/json",
242+
},
243+
}
244+
}
245+
```
246246

247247
- With object/entity (number, boolean, string...) without properties body and statusCode
248-
```js
249-
module.exports.myHandler = (event, context, callback) => {
250-
return {
251-
body: "message",
252-
headers: {
253-
"Content-Type": ["text/plain"],
254-
},
255-
};
256-
// Or
257-
return JSON.stringify({ message: "message" });
258-
// OR
259-
return "Hello, world";
260-
// OR
261-
return 1; // true, false, undefined, null...
262-
};
263-
```
264-
265-
**Using the callback parameter:**
266248

267-
```js
268-
module.exports.myHandler = (event, context, callback) => {
269-
const response = {
270-
statusCode: 201,
271-
body: {
272-
message: "async function",
273-
},
274-
headers: {
275-
"Content-Type": "application/json",
276-
},
277-
};
278-
// Successful response
279-
callback(undefined, response);
280-
// Error response
281-
callback(new Error("something bad happened..."));
282-
};
283-
```
249+
```js
250+
module.exports.myHandler = (event, context, callback) => {
251+
return {
252+
body: "message",
253+
headers: {
254+
"Content-Type": ["text/plain"],
255+
},
256+
};
257+
// Or
258+
return JSON.stringify({ message: "message" });
259+
// OR
260+
return "Hello, world";
261+
// OR
262+
return 1; // true, false, undefined, null...
263+
};
264+
```
265+
266+
**Using the callback parameter:**
267+
268+
```js
269+
module.exports.myHandler = (event, context, callback) => {
270+
const response = {
271+
statusCode: 201,
272+
body: {
273+
message: "async function",
274+
},
275+
headers: {
276+
"Content-Type": "application/json",
277+
},
278+
};
279+
// Successful response
280+
callback(undefined, response);
281+
// Error response
282+
callback(new Error("something bad happened..."));
283+
};
284+
```
284285

285286
- With a `Promise`:
286287

287-
```js
288-
module.exports.myHandler = async (event, context, callback) => {
289-
return {
290-
statusCode: 201,
291-
body: {
292-
message: "async function",
293-
},
294-
headers: {
295-
"Content-Type": "application/json",
296-
},
297-
};
298-
}
288+
```js
289+
module.exports.myHandler = async (event, context, callback) => {
290+
return {
291+
statusCode: 201,
292+
body: {
293+
message: "async function",
294+
},
295+
headers: {
296+
"Content-Type": "application/json",
297+
},
298+
};
299+
}
299300

300-
// OR
301-
module.exports.myHandler = (event, context, callback) => {
302-
const response = {
303-
statusCode: 201,
304-
body: {
305-
message: "async function",
306-
},
307-
headers: {
308-
"Content-Type": "application/json",
309-
},
310-
};
301+
// OR
302+
module.exports.myHandler = (event, context, callback) => {
303+
const response = {
304+
statusCode: 201,
305+
body: {
306+
message: "async function",
307+
},
308+
headers: {
309+
"Content-Type": "application/json",
310+
},
311+
};
311312

312-
return new Promise((resolve, reject) => {
313-
// do something
314-
if (err) return reject(err);
315-
return resolve(response);
316-
});
317-
};
318-
```
313+
return new Promise((resolve, reject) => {
314+
// do something
315+
if (err) return reject(err);
316+
return resolve(response);
317+
});
318+
};
319+
```
319320

320321
### Using environment variables in Node
321322

@@ -359,7 +360,7 @@ module.exports.myHandler = (event, context, callback) => {
359360

360361
Example of reading URL parameters:
361362

362-
```
363+
```sh
363364
curl https://myfunc/user/?id=1
364365
```
365366

@@ -652,7 +653,7 @@ func Handle(w http.ResponseWriter, r *http.Request) {
652653

653654
Example of reading URL parameters:
654655

655-
```
656+
```sh
656657
curl https://myfunc/user/?id=1
657658
```
658659

@@ -793,7 +794,7 @@ function handle($event, $context) {
793794

794795
Example of reading URL parameters:
795796

796-
```
797+
```sh
797798
curl https://myfunc/user/?id=1
798799
```
799800

pages/serverless-functions/reference-content/cron-schedules.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Cron schedules reference
33
description: Learn to set up and manage cron schedules in Scaleway Serverless Functions.
44
tags: serverless functions cron crontab schedule cronjob
55
dates:
6-
validation: 2025-02-11
6+
validation: 2025-09-02
77
posted: 2023-12-12
88
---
99
import CronSchedules from '@macros/serverless/cron-schedules.mdx'

pages/serverless-functions/reference-content/functions-autoscaling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Functions autoscaling reference
33
description: Understand how autoscaling works for Serverless Functions in Scaleway.
44
tags: serverless functions autoscaling scale up down min max
55
dates:
6-
validation: 2025-02-18
6+
validation: 2025-09-02
77
posted: 2025-02-18
88
---
99

pages/serverless-functions/reference-content/functions-billing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Serverless Functions billing
33
description: Understand billing for Scaleway Serverless Functions with this guide.
44
tags: functions serverless serverless-functions billing serverless-billing serverless-functions-billing
55
dates:
6-
validation: 2025-02-11
6+
validation: 2025-09-02
77
posted: 2023-06-15
88
---
99

pages/serverless-functions/reference-content/functions-limitations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Functions limitations
33
description: Learn about limitations for Scaleway Serverless Functions including resource and execution constraints.
44
tags: functions limitations serverless
55
dates:
6-
validation: 2025-02-10
6+
validation: 2025-09-02
77
posted: 2021-10-12
88
---
99

pages/serverless-functions/reference-content/local-testing.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ title: Functions local testing
33
description: Learn how to test your Serverless Functions locally before deployment on Scaleway.
44
tags: functions serverless local testing
55
dates:
6-
validation: 2025-02-11
6+
validation: 2025-09-02
77
posted: 2023-03-06
88
---
99

1010
Local testing allows you to run your code on your development environment with a short deploy time.
1111

12-
1312
Scaleway Serverless Functions can run outside Scaleway infrastructures. This is useful to set up, develop, and test functions locally. You can run functions directly on your machines to debug them and analyze logs.
1413

1514
Each local testing framework is written in its respective language and emulates the calls made to functions by the Scaleway infrastructure.

0 commit comments

Comments
 (0)