diff --git a/src/DotNetWorker.Grpc/Definition/GrpcFunctionDefinition.cs b/src/DotNetWorker.Grpc/Definition/GrpcFunctionDefinition.cs index 08ba2d952..2b9d2335e 100644 --- a/src/DotNetWorker.Grpc/Definition/GrpcFunctionDefinition.cs +++ b/src/DotNetWorker.Grpc/Definition/GrpcFunctionDefinition.cs @@ -21,10 +21,10 @@ public GrpcFunctionDefinition(FunctionLoadRequest loadRequest, IMethodInfoLocato Name = loadRequest.Metadata.Name; Id = loadRequest.FunctionId; - string? scriptRoot = Environment.GetEnvironmentVariable("AzureWebJobsScriptRoot"); + string? scriptRoot = Environment.GetEnvironmentVariable("FUNCTIONS_WORKER_DIRECTORY"); if (string.IsNullOrWhiteSpace(scriptRoot)) { - throw new InvalidOperationException("The 'AzureWebJobsScriptRoot' environment variable value is not defined. This is a required environment variable that is automatically set by the Azure Functions runtime."); + throw new InvalidOperationException("The 'FUNCTIONS_WORKER_DIRECTORY' environment variable value is not defined. This is a required environment variable that is automatically set by the Azure Functions runtime."); } if (string.IsNullOrWhiteSpace(loadRequest.Metadata.ScriptFile)) diff --git a/src/DotNetWorker.Grpc/DotNetWorker.Grpc.csproj b/src/DotNetWorker.Grpc/DotNetWorker.Grpc.csproj index 680672fd5..4028ebcc6 100644 --- a/src/DotNetWorker.Grpc/DotNetWorker.Grpc.csproj +++ b/src/DotNetWorker.Grpc/DotNetWorker.Grpc.csproj @@ -9,6 +9,7 @@ Microsoft.Azure.Functions.Worker.Grpc true 8 + 1 -preview1 true diff --git a/src/DotNetWorker/DotNetWorker.csproj b/src/DotNetWorker/DotNetWorker.csproj index 565330412..7cf0f471c 100644 --- a/src/DotNetWorker/DotNetWorker.csproj +++ b/src/DotNetWorker/DotNetWorker.csproj @@ -9,6 +9,7 @@ Microsoft.Azure.Functions.Worker true 12 + 1 -preview1 diff --git a/test/DotNetWorkerTests/GrpcFunctionDefinitionTests.cs b/test/DotNetWorkerTests/GrpcFunctionDefinitionTests.cs index 009dd9800..2edffc281 100644 --- a/test/DotNetWorkerTests/GrpcFunctionDefinitionTests.cs +++ b/test/DotNetWorkerTests/GrpcFunctionDefinitionTests.cs @@ -19,7 +19,7 @@ public class GrpcFunctionDefinitionTests [Fact] public void Creates() { - using var testVariables = new TestScopedEnvironmentVariable("AzureWebJobsScriptRoot", "."); + using var testVariables = new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_DIRECTORY", "."); var bindingInfoProvider = new DefaultOutputBindingsInfoProvider(); var methodInfoLocator = new DefaultMethodInfoLocator(); diff --git a/test/DotNetWorkerTests/GrpcWorkerTests.cs b/test/DotNetWorkerTests/GrpcWorkerTests.cs index f71483836..ad763dcaf 100644 --- a/test/DotNetWorkerTests/GrpcWorkerTests.cs +++ b/test/DotNetWorkerTests/GrpcWorkerTests.cs @@ -73,7 +73,7 @@ public GrpcWorkerTests() [Fact] public void LoadFunction_ReturnsSuccess() { - using var testVariables = new TestScopedEnvironmentVariable("AzureWebJobsScriptRoot", "test"); + using var testVariables = new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_DIRECTORY", "test"); FunctionLoadRequest request = CreateFunctionLoadRequest(); @@ -97,7 +97,7 @@ public void LoadFunction_WithProxyMetadata_ReturnsSuccess() [Fact] public void LoadFunction_Throws_ReturnsFailure() { - using var testVariables = new TestScopedEnvironmentVariable("AzureWebJobsScriptRoot", "test"); + using var testVariables = new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_DIRECTORY", "test"); _mockApplication .Setup(m => m.LoadFunction(It.IsAny())) @@ -115,7 +115,7 @@ public void LoadFunction_Throws_ReturnsFailure() [Fact] public void MethodInfoLocator_Throws_ReturnsFailure() { - using var testVariables = new TestScopedEnvironmentVariable("AzureWebJobsScriptRoot", "test"); + using var testVariables = new TestScopedEnvironmentVariable("FUNCTIONS_WORKER_DIRECTORY", "test"); _mockMethodInfoLocator .Setup(m => m.GetMethod(It.IsAny(), It.IsAny()))