Skip to content

Commit

Permalink
chore(csharp): update nodejs version to 20.x
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed May 24, 2024
1 parent 9164f0e commit 92e85a7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public MyWidgetServiceStack(Construct parent, string id, IStackProps props) : ba
var bucket = new Bucket(this, "WidgetStore");

var handler = new Function(this, "WidgetHandler", new FunctionProps {
Runtime = Runtime.NODEJS_10_X,
Runtime = Runtime.NODEJS_20_X,

Check failure on line 17 in csharp/my-widget-service/src/MyWidgetService/MyWidgetServiceStack.cs

View workflow job for this annotation

GitHub Actions / build (csharp)

'Runtime' does not contain a definition for 'NODEJS_20_X'

Check failure on line 17 in csharp/my-widget-service/src/MyWidgetService/MyWidgetServiceStack.cs

View workflow job for this annotation

GitHub Actions / build (csharp)

'Runtime' does not contain a definition for 'NODEJS_20_X'
Code = Code.FromAsset("src/MyWidgetService/resources"),
Handler = "widgets.main",
Environment = new Dictionary<string, string>{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AWS = require('aws-sdk');
const S3 = new AWS.S3();
const { S3 } = require("@aws-sdk/client-s3");
const s3 = new S3();

const bucketName = process.env.BUCKET;

Expand All @@ -12,7 +12,7 @@ exports.main = async function(event, context) {
if (method === "GET") {
// GET / to get the names of all widgets
if (event.path === "/") {
const data = await S3.listObjectsV2({ Bucket: bucketName }).promise();
const data = await s3.listObjectsV2({ Bucket: bucketName });
var body = {
widgets: data.Contents.map(function(e) { return e.Key })
};
Expand All @@ -25,8 +25,8 @@ exports.main = async function(event, context) {

if (widgetName) {
// GET /name to get info on widget name
const data = await S3.getObject({ Bucket: bucketName, Key: widgetName}).promise();
var body = data.Body.toString('utf-8');
const data = await s3.getObject({ Bucket: bucketName, Key: widgetName});
var body = await data.Body.transformToString();

return {
statusCode: 200,
Expand All @@ -53,12 +53,12 @@ exports.main = async function(event, context) {

var base64data = new Buffer(data, 'binary');

await S3.putObject({
await s3.putObject({
Bucket: bucketName,
Key: widgetName,
Body: base64data,
ContentType: 'application/json'
}).promise();
});

return {
statusCode: 200,
Expand All @@ -78,9 +78,9 @@ exports.main = async function(event, context) {
};
}

await S3.deleteObject({
await s3.deleteObject({
Bucket: bucketName, Key: widgetName
}).promise();
});

return {
statusCode: 200,
Expand Down
2 changes: 1 addition & 1 deletion csharp/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"devDependencies": {
"aws-cdk": "^2.0.0-rc.32"
"aws-cdk": "2.133.0"
}
}
2 changes: 1 addition & 1 deletion csharp/random-writer/src/RandomWriter/RandomWriterStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public RandomWriter(Construct scope, string id): base(scope, id)

Function = new Function(this, "Lambda", new FunctionProps
{
Runtime = Runtime.NODEJS_10_X,
Runtime = Runtime.NODEJS_20_X,

Check failure on line 43 in csharp/random-writer/src/RandomWriter/RandomWriterStack.cs

View workflow job for this annotation

GitHub Actions / build (csharp)

'Runtime' does not contain a definition for 'NODEJS_20_X'

Check failure on line 43 in csharp/random-writer/src/RandomWriter/RandomWriterStack.cs

View workflow job for this annotation

GitHub Actions / build (csharp)

'Runtime' does not contain a definition for 'NODEJS_20_X'
Handler = "index.handler",
Code = Code.FromAsset("src/RandomWriter/resources"),
Environment = new Dictionary<string, string>
Expand Down
4 changes: 2 additions & 2 deletions csharp/random-writer/src/RandomWriter/resources/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { DynamoDB } = require('aws-sdk');
const { DynamoDB } = require('@aws-sdk/client-dynamodb');
const crypto = require('crypto');

/**
Expand All @@ -22,5 +22,5 @@ exports.handler = async function handler(event, context) {
Item: {
ID: { S: id }
}
}).promise();
});
};

0 comments on commit 92e85a7

Please sign in to comment.