You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using Azure Data Factory management client and trying to connect to it through an azure functions app. It seems like when initializing the service client I get an invalid type when it tries to add to the array.
Exception or Stack Trace
"Exception while executing function: ScheduleNotifications -> Attempted to access an element as a type incompatible with the array.",
"errorDetails": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: ScheduleNotifications ---> System.ArrayTypeMismatchException : Attempted to access an element as a type incompatible with the array.\r\n at System.Collections.Generic.List1.Add(T item)\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient.Initialize()\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient..ctor(DelegatingHandler[] handlers)\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient..ctor(ServiceClientCredentials credentials,DelegatingHandler[] handlers)\r\n at DataFactorySDK.FactoryAuth.GetClient() at C:\\Users\\dedaq\\source\\repos\\DataFactorySDK\\DataFactorySDK\\FactoryAuth.cs : 44\r\n at ScheduleBatch.ScheduleNotifications.ScheduleDelivery(String location,String deliveryDate,String filePath,List1 intervals,TraceWriter log)\r\n at async ScheduleBatch.ScheduleNotifications.Run(HttpRequestMessage req,TraceWriter log)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) \r\n End of inner exception\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)\r\n at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary2 arguments,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.Host.FunctionRequestInvoker.ProcessRequestAsync(HttpRequestMessage request,CancellationToken cancellationToken,WebScriptHostManager scriptHostManager,WebHookReceiverManager webHookReceiverManager)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.b__0(??)\r\n at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)"
To Reproduce
Try to create an Azure Data Factory Client inside of an azure function app. Just initialize it with tokens from the azure portal ( I ran it locally and triggered with postman).
Code Snippet
public DataFactoryManagementClient GetClient()
{
var context = new AuthenticationContext("https://login.windows.net/" + tenantID);
ClientCredential cc = new ClientCredential(applicationId, authenticationKey);
AuthenticationResult result = context.AcquireTokenAsync(
"https://management.azure.com/", cc).Result;
// This is the line that it breaks on... it seems like it's not calling initializeServiceClient with
//the right types
ServiceClientCredentials cred = new TokenCredentials(result.AccessToken);
return new DataFactoryManagementClient(cred)
{
SubscriptionId = subscriptionId
};
}
The text was updated successfully, but these errors were encountered:
I fixed this by lowering the version of the azure data factory .net sdk. I think it's a dependency issue associated with azure functions and not with the ServiceClient.
@graham-saunders I didn't use Microsoft.Azure.Search.Data nuget but I found that lowering newtonsoft to version 10 fixed it for me, this is inside of a different thread here, my problem was azure functions and not ServiceClient
Describe the bug
I am using Azure Data Factory management client and trying to connect to it through an azure functions app. It seems like when initializing the service client I get an invalid type when it tries to add to the array.
Exception or Stack Trace
"Exception while executing function: ScheduleNotifications -> Attempted to access an element as a type incompatible with the array.",
"errorDetails": "Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: ScheduleNotifications ---> System.ArrayTypeMismatchException : Attempted to access an element as a type incompatible with the array.\r\n at System.Collections.Generic.List
1.Add(T item)\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient.Initialize()\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient..ctor(DelegatingHandler[] handlers)\r\n at Microsoft.Azure.Management.DataFactory.DataFactoryManagementClient..ctor(ServiceClientCredentials credentials,DelegatingHandler[] handlers)\r\n at DataFactorySDK.FactoryAuth.GetClient() at C:\\Users\\dedaq\\source\\repos\\DataFactorySDK\\DataFactorySDK\\FactoryAuth.cs : 44\r\n at ScheduleBatch.ScheduleNotifications.ScheduleDelivery(String location,String deliveryDate,String filePath,List
1 intervals,TraceWriter log)\r\n at async ScheduleBatch.ScheduleNotifications.Run(HttpRequestMessage req,TraceWriter log)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker2.InvokeAsync[TReflected,TReturnValue](Object instance,Object[] arguments)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeAsync(IFunctionInvoker invoker,ParameterHelper parameterHelper,CancellationTokenSource timeoutTokenSource,CancellationTokenSource functionCancellationTokenSource,Boolean throwOnTimeout,TimeSpan timerInterval,IFunctionInstance instance)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??) \r\n End of inner exception\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)\r\n at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.TryExecuteAsync(IFunctionInstance functionInstance,CancellationToken cancellationToken)\r\n at Microsoft.Azure.WebJobs.Host.Executors.ExceptionDispatchInfoDelayedException.Throw()\r\n at async Microsoft.Azure.WebJobs.JobHost.CallAsync(??)\r\n at async Microsoft.Azure.WebJobs.Script.ScriptHost.CallAsync(String method,Dictionary
2 arguments,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager.HandleRequestAsync(FunctionDescriptor function,HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.Host.FunctionRequestInvoker.ProcessRequestAsync(HttpRequestMessage request,CancellationToken cancellationToken,WebScriptHostManager scriptHostManager,WebHookReceiverManager webHookReceiverManager)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.<>c__DisplayClass3_0.b__0(??)\r\n at async Microsoft.Azure.WebJobs.Extensions.Http.HttpRequestManager.ProcessRequestAsync(HttpRequestMessage request,Func`3 processRequestHandler,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Controllers.FunctionsController.ExecuteAsync(HttpControllerContext controllerContext,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.WebScriptHostHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async Microsoft.Azure.WebJobs.Script.WebHost.Handlers.SystemTraceHandler.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)\r\n at async System.Web.Http.HttpServer.SendAsync(HttpRequestMessage request,CancellationToken cancellationToken)"To Reproduce
Try to create an Azure Data Factory Client inside of an azure function app. Just initialize it with tokens from the azure portal ( I ran it locally and triggered with postman).
Code Snippet
The text was updated successfully, but these errors were encountered: