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

QueueTrigger appears to be broke with Microsoft.NET.Sdk.Functions 1.0.19 #1889

Closed
cResults opened this issue Sep 7, 2018 · 18 comments
Closed
Assignees

Comments

@cResults
Copy link

cResults commented Sep 7, 2018

below is my Azure Function that worked with 1.0.14

        [FunctionName("LaunchTenantListener")]
        public static async Task Run([QueueTrigger(Constants.Queue, Connection = Constants.StorageConnection)]string tenantID, [Inject] PollQueuesForTenant pollQueuesForTenant)
        {
            await pollQueuesForTenant.Execute(tenantID);
        }

I'm currently getting this error.

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=Input string '5c61b624-567e-433e-a28c-8b044430f087' is not a valid number. Path '', line 1, position 36.
  Source=Newtonsoft.Json
  StackTrace:
   at Newtonsoft.Json.JsonTextReader.ParseReadNumber(ReadType readType, Char firstChar, Int32 initialPosition)
   at Newtonsoft.Json.JsonTextReader.ParseNumber(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader)
   at Microsoft.Azure.WebJobs.Host.Protocols.JsonSerialization.ParseJObject(String json) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Protocols\JsonSerialization.cs:line 102
   at Microsoft.Azure.WebJobs.Host.Queues.QueueCausalityManager.GetOwner(CloudQueueMessage msg) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.Storage\Queues\QueueCausalityManager.cs:line 55

Since our code wasn't anywhere in the stack trace I changed the message that was being posted to the queue to a number and now I get

Newtonsoft.Json.JsonReaderException
  HResult=0x80131500
  Message=Error reading JObject from JsonReader. Current JsonReader item is not an object: Integer. Path '', line 1, position 3.
  Source=Newtonsoft.Json
  StackTrace:
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader)
   at Microsoft.Azure.WebJobs.Host.Protocols.JsonSerialization.ParseJObject(String json) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Protocols\JsonSerialization.cs:line 102
   at Microsoft.Azure.WebJobs.Host.Queues.QueueCausalityManager.GetOwner(CloudQueueMessage msg) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Extensions.Storage\Queues\QueueCausalityManager.cs:line 55

Also, can you please point me to the proper place for me to post that my local storage no longer appears in Cloud Explorer?

Thank you for an amazing product that in continuously getting more awesome.

@cResults
Copy link
Author

cResults commented Sep 7, 2018

I created an object with a single string property and posted it to the storage queue and the QueueTrigger works with that. This is a work around that one shouldn't need to do. Please make it better.

@paulbatum paulbatum added this to the Active Questions milestone Sep 10, 2018
@nzthiago
Copy link
Member

We have also run into this today; even though you declare the queue trigger object as a string, the webjobs sdk is trying to json parse it, and it throws a Newtonsoft.Json.JsonReaderException on this line:

JObject parsed = JObject.Load(jsonReader);

@wely-zz
Copy link

wely-zz commented Sep 12, 2018

I ran into similar issue. Here're the screenshots:
screenshot1

screenshot2

@JuanKRuiz
Copy link

JuanKRuiz commented Sep 19, 2018

Hi guys! I'm dealing with the same on v 1.0.21 , and the main problem is that if you're using the QueueTrigguer to get the PartitionKey or RowKey for a Table /Storage/ binding everything gets broken.

        [FunctionName("DeployTeamsConfiguration" )]
        public static void Run(
            [QueueTrigger(TEAMS_TASK_QUEUE)]
            string teamTask,
            [Table(TEAM_TASK_TABLE, "TeamsTask", "{queueTrigger}")]
            TeamsConfiguration teamsConfig)

@mathewc
Copy link
Member

mathewc commented Sep 19, 2018

Guys - I believe you're just seeing first chance exceptions in the debugger. The queue trigger does do a try/parse generating exceptions, but we handle those. Can you guys confirm that if you F5 past this error the function actually works as intended? If so, then you just need to change your VS exception settings to ignore these.

@jeffhollan
Copy link

Yes I hit this sometimes too. Will keep on eye on what this could be but for mitigation if you unclick this it will stop bothering you.

workaround

@nzthiago
Copy link
Member

Should it even try parse if the object type is set to string?

@JuanKRuiz
Copy link

Guys - I believe you're just seeing first chance exceptions in the debugger. The queue trigger does do a try/parse generating exceptions, but we handle those. Can you guys confirm that if you F5 past this error the function actually works as intended? If so, then you just need to change your VS exception settings to ignore these.

yes I've used that as mitigation.

@JuanKRuiz
Copy link

Should it even try parse if the object type is set to string?

Yes, the exceptions are jumping everytime the queued message doesn't match a json object.

@rasmuschristensen
Copy link

Just ran into this issue too. Posting a json formatted string into the queue removes the exception and If I use a Type as the message, its also serialized correctly. Still sees it as a pain that the exception is thrown

@jeffhollan
Copy link

@paulbatum this seems to be picking up steam. Not sure if something reverted in latest VS bits? I see this on both my machines that have VS 2017 15.9.0 Preview 2.0

@superjulius
Copy link

Also noticed it with SDK 3.0 while it was not the case with 2.x. I understood that the underlying exception was indeed handled by the SDK but still annoying and confusing to get such errors while debugging.

Would be great if this was not surfacing at all and as @nzthiago said, should it even try to deserialize and handle exception if the type is string. Might not be that easy to detect though...

@mathewc
Copy link
Member

mathewc commented Sep 27, 2018

PR #1930 is out to address this

@paulbatum
Copy link
Member

The PR is now merged. For users to get this fix we'll need to release an updated build of the Microsoft.Azure.WebJobs.Extensions.Storage NuGet package and then users will have to grab the update. The package should be published by mid October.

@mathewc
Copy link
Member

mathewc commented Oct 8, 2018

Closing because this has been fixed.

@mathewc mathewc closed this as completed Oct 8, 2018
@ksoakellho
Copy link

Hi @paulbatum, do you by any chance, have a release date for this package?

@paulbatum
Copy link
Member

@ksoakellho should be within the next two weeks.

@JohnReeson
Copy link

Work with latest v3.0.1 Microsoft.Azure.WebJobs.Extensions.Storage, no exception is thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests