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

chore(csharp): update nodejs version to 20.x #1039

Merged
merged 9 commits into from
May 30, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
# ts will use the one from the particular cdk app
if [[ ${{ matrix.language }} != 'typescript' ]]; then
npm install -g aws-cdk
npx cdk --version
fi

# Run the build_file function in parallel for each project to be built
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.CDK.Lib" Version="2.0.0" />
<PackageReference Include="Constructs" Version="10.0.0" />
<PackageReference Include="Amazon.CDK.Lib" Version="2.143.0" />
<PackageReference Include="Constructs" Version="10.0" />
</ItemGroup>

</Project>
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,
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/random-writer/src/RandomWriter/RandomWriter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.CDK.Lib" Version="2.0.0" />
<PackageReference Include="Amazon.CDK.Lib" Version="2.143.0" />
<PackageReference Include="Constructs" Version="10.0.0" />
</ItemGroup>

Expand Down
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,
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();
});
};
Loading