Skip to content

Commit

Permalink
Update Node.js Worker Version to 3.8.1 (#9473)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba committed Aug 23, 2023
1 parent 13788be commit 1e52813
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
- Increase timeout for http proxying requests [#9433](https://github.com/Azure/azure-functions-host/pull/9433)
- Improve host.json sanitization
- Increased maximum HTTP request content size to 210000000 Bytes (~200MB)
- Update Node.js Worker Version to [3.8.1](https://github.com/Azure/azure-functions-nodejs-worker/releases/tag/v3.8.1)
2 changes: 1 addition & 1 deletion src/WebJobs.Script/WebJobs.Script.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<!-- Workers -->
<PackageReference Include="Microsoft.Azure.AppService.Proxy.Client" Version="2.2.20220831.41" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.12.1" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.8.0" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.8.1" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.2850" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.2890" />
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.2802" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const func = require('@azure/functions-core');

func.registerHook('postInvocation', async () => {
// Add slight delay to ensure logs show up before the invocation finishes
// See these issues for more info:
// https://github.com/Azure/azure-functions-host/issues/9238
// https://github.com/Azure/azure-functions-host/issues/8222
await new Promise((resolve) => setTimeout(resolve, 100));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "nodeapp",
"version": "1.0.0",
"description": "",
"scripts": {
"start": "func start",
"test": "echo \"No tests yet...\""
},
"dependencies": {},
"devDependencies": {},
"main": "index.js"
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,19 @@ public async Task Scenario_Logging()

// verify log levels in traces
LogMessage[] traces = Fixture.Host.GetScriptHostLogMessages(userCategory).Where(t => t.FormattedMessage != null && t.FormattedMessage.Contains("loglevel")).ToArray();
Assert.Equal(LogLevel.Information, traces[0].Level);
Assert.Equal("loglevel default", traces[0].FormattedMessage);
Assert.Equal(LogLevel.Information, traces[1].Level);
Assert.Equal("loglevel info", traces[1].FormattedMessage);
Assert.Equal(LogLevel.Trace, traces[2].Level);
Assert.Equal("loglevel verbose", traces[2].FormattedMessage);
Assert.Equal(LogLevel.Warning, traces[3].Level);
Assert.Equal("loglevel warn", traces[3].FormattedMessage);
Assert.Equal(LogLevel.Error, traces[4].Level);
Assert.Equal("loglevel error", traces[4].FormattedMessage);
Assert.True(traces.Any(t => t.Level == LogLevel.Information && t.FormattedMessage == "loglevel default" ));
Assert.True(traces.Any(t => t.Level == LogLevel.Information && t.FormattedMessage == "loglevel info" ));
Assert.True(traces.Any(t => t.Level == LogLevel.Trace && t.FormattedMessage == "loglevel verbose" ));
Assert.True(traces.Any(t => t.Level == LogLevel.Warning && t.FormattedMessage == "loglevel warn" ));
Assert.True(traces.Any(t => t.Level == LogLevel.Error && t.FormattedMessage == "loglevel error" ));

// verify most of the logs look correct
Assert.EndsWith("Mathew Charles", userLogs[1]);
Assert.EndsWith("null", userLogs[2]);
Assert.EndsWith("1234", userLogs[3]);
Assert.EndsWith("true", userLogs[4]);
Assert.EndsWith("loglevel default", userLogs[5]);
Assert.EndsWith("loglevel info", userLogs[6]);
Assert.True(userLogs.Contains("Mathew Charles"));
Assert.True(userLogs.Contains("null"));
Assert.True(userLogs.Contains("1234"));
Assert.True(userLogs.Contains("true"));
Assert.True(userLogs.Contains("loglevel default"));
Assert.True(userLogs.Contains("loglevel info"));

// verify the console log
Assert.Equal("console log", consoleLog);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.11.2" />
<PackageReference Include="Microsoft.Azure.EventHubs" Version="2.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.8.0" />
<PackageReference Include="Microsoft.Azure.Functions.NodeJsWorker" Version="3.8.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5-11874" />
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.12.1" />
<PackageReference Include="Microsoft.Azure.Mobile.Client" Version="4.0.2" />
Expand Down

0 comments on commit 1e52813

Please sign in to comment.