Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
431 stars 184 forks source link

Cannot convert to IReadOnlyList<my_type> from System.String while migrating to .net8 isolated from .net6 in-process #2621

Open dhananjaytyagi24 opened 3 months ago

dhananjaytyagi24 commented 3 months ago

Description

On a previous post regarding the same error, the solution was mentioned as moving to Microsoft.Azure.Functions.Worker.Sdk version 1.16.1. I am on the latest sdk(1.17.4) but I am still facing this issue.-

Function 'xyz', Invocation id 'abc': An exception was thrown by the invocation. Result: Function 'xyz', Invocation id 'abc: An exception was thrown by the invocation. Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'xyz': Cannot convert input parameter 'input' to type 'System.Collections.Generic.IReadOnlyList`1[my_object_type]' from type 'System.String'. Error:System.Text.Json.JsonException: The JSON value could not be converted to Enums.type. Path: $[0].entityType | LineNumber: 0 | BytePositionInLine: 340.

Please suggest how to resolve this issue.

Steps to reproduce

Create a test in-process CosmosDB trigger azure function in .net6 then migrate to .net8 isolated function. Update the rest of the code accordingly to run in .net8 Run the code and put break point to see if the function was called and this error comes up.

kshyju commented 3 months ago

@dhananjaytyagi24

I followed the two steps you provided for the reproduction, but I wasn't able to replicate the error you described.

Are there any specific steps I might be missing? Could you follow the two steps mentioned in the "Steps to Reproduce" section to see if you still encounter the error? If so, there might be a difference between our reproductions. Once you identify any additional factors, please share that information, and we will be happy to investigate further.

dhananjaytyagi24 commented 3 months ago

@dhananjaytyagi24

I followed the two steps you provided for the reproduction, but I wasn't able to replicate the error you described.

Are there any specific steps I might be missing? Could you follow the two steps mentioned in the "Steps to Reproduce" section to see if you still encounter the error? If so, there might be a difference between our reproductions. Once you identify any additional factors, please share that information, and we will be happy to investigate further.

I have updated the repro steps, please take a look.

skittishsahil commented 3 months ago

Found any solution yet for this @dhananjaytyagi24 ?

kshyju commented 3 months ago

@dhananjaytyagi24 Are you using the migration tool to do the net6 to net8 migration?

dhananjaytyagi24 commented 3 months ago

No solution yet. Yes, I used the migration tool to upgrade to .net8

On Tue, Aug 6, 2024 at 1:41 PM Shyju Krishnankutty @.***> wrote:

@dhananjaytyagi24 https://github.com/dhananjaytyagi24 Are you using the migration tool to do the net6 to net8 migration?

— Reply to this email directly, view it on GitHub https://github.com/Azure/azure-functions-dotnet-worker/issues/2621#issuecomment-2272111752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGIU4KTANVSGGMVJBJBGQDZQEYILAVCNFSM6AAAAABLJFPXDWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSGEYTCNZVGI . You are receiving this because you were mentioned.Message ID: @.***>

-- Regards Dhananjay Tyagi