Skip to content

Commit 4e5dd8e

Browse files
Triippzcamden11hmcdonald-hs
authored
Bump platformVersion to 2023.2 (#19)
* Bump to platformVersion 2023.2 * Bump node runtime to 18 * Use async/await * Remove runtime and version * Update example functions to use async --------- Co-authored-by: Camden Phalen <cphalen@hubspot.com> Co-authored-by: Hugh McDonald <hmcdonald@hubspot.com>
1 parent ff115c3 commit 4e5dd8e

File tree

8 files changed

+12
-26
lines changed

8 files changed

+12
-26
lines changed
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
exports.main = (context = {}, sendResponse) => {
1+
exports.main = async (context = {}) => {
22
const { text } = context.parameters;
33

44
const response = `This is coming from a serverless function! You entered: ${text}`;
55

6-
try {
7-
sendResponse(response);
8-
} catch (error) {
9-
sendResponse(error);
10-
}
6+
return response;
117
};

components/example-app/app.functions/serverless.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"runtime": "nodejs16.x",
3-
"version": "1.0",
42
"appFunctions": {
53
"myFunc": {
64
"file": "example-function.js",

components/example-app/extensions/Example.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const Extension = ({ context, runServerless, sendAlert }) => {
2424

2525
// Call serverless function to execute with parameters.
2626
// The `myFunc` function name is configured inside `serverless.json`
27-
const handleClick = () => {
28-
runServerless({ name: "myFunc", parameters: { text: text } }).then((resp) =>
29-
sendAlert({ message: resp.response })
30-
);
27+
const handleClick = async () => {
28+
const { response } = await runServerless({ name: "myFunc", parameters: { text: text } });
29+
sendAlert({ message: response });
3130
};
3231

3332
return (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "Get Started Project",
33
"srcDir": "src",
4-
"platformVersion": "2023.1"
4+
"platformVersion": "2023.2"
55
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
exports.main = (context = {}, sendResponse) => {
1+
exports.main = async (context = {}) => {
22
const { text } = context.parameters;
33

44
const response = `This is coming from a serverless function! You entered: ${text}`;
55

6-
try {
7-
sendResponse(response);
8-
} catch (error) {
9-
sendResponse(error);
10-
}
6+
return response;
117
};

projects/getting-started-template/src/app/app.functions/serverless.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"runtime": "nodejs16.x",
3-
"version": "1.0",
42
"appFunctions": {
53
"myFunc": {
64
"file": "example-function.js",

projects/getting-started-template/src/app/extensions/Example.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const Extension = ({ context, runServerless, sendAlert }) => {
2424

2525
// Call serverless function to execute with parameters.
2626
// The `myFunc` function name is configured inside `serverless.json`
27-
const handleClick = () => {
28-
runServerless({ name: "myFunc", parameters: { text: text } }).then((resp) =>
29-
sendAlert({ message: resp.response })
30-
);
27+
const handleClick = async () => {
28+
const { response } = await runServerless({ name: "myFunc", parameters: { text: text } });
29+
sendAlert({ message: response });
3130
};
3231

3332
return (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "Empty Project",
33
"srcDir": "src",
4-
"platformVersion": "2023.1"
4+
"platformVersion": "2023.2"
55
}

0 commit comments

Comments
 (0)