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

PutASync returning ''{' is invalid after a value. Expected either ',', '}', or ']' #2487

Closed
petersmithfromengland opened this issue May 13, 2024 · 1 comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@petersmithfromengland
Copy link

petersmithfromengland commented May 13, 2024

Describe the bug

I have been following this graph connector tutorial and have modified slightly to accommodate a list of helpdesk (fresh service) Articles.

When I have created a connection, registered the schema and attempted to push data from a test csv up I am getting the below error

System.Text.Json.JsonReaderException HResult=0x80131500 Message='{' is invalid after a value. Expected either ',', '}', or ']'. LineNumber: 0 | BytePositionInLine: 232. Source=System.Text.Json StackTrace: at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.JsonDocument.Parse(ReadOnlySpan1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb& database, StackRowStack& stack) at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedArrayPoolBytes, PooledByteBufferWriter extraPooledByteBufferWriter)
at System.Text.Json.JsonDocument.Parse(Stream utf8Json, JsonDocumentOptions options)
at Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory.GetRootParseNode(String contentType, Stream content)
at Microsoft.Kiota.Abstractions.Serialization.ParseNodeProxyFactory.GetRootParseNode(String contentType, Stream content)
at Microsoft.Kiota.Abstractions.Serialization.ParseNodeFactoryRegistry.GetRootParseNode(String contentType, Stream content)
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.d__30.MoveNext()
at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.d__201.MoveNext() at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.<SendAsync>d__201.MoveNext()
at Microsoft.Graph.External.Connections.Item.Items.Item.ExternalItemItemRequestBuilder.d__8.MoveNext()
at FreshServiceConnector.Graph.GraphHelper.d__9.MoveNext() in Z:_github\FreshServiceConnector\Graph\GraphHelper.cs:line 143

This exception was originally thrown at this call stack:
System.Text.Json.ThrowHelper.ThrowJsonReaderException(ref System.Text.Json.Utf8JsonReader, System.Text.Json.ExceptionResource, byte, System.ReadOnlySpan)
System.Text.Json.Utf8JsonReader.ConsumeNextToken(byte)
System.Text.Json.Utf8JsonReader.ReadSingleSegment()
System.Text.Json.Utf8JsonReader.Read()
System.Text.Json.JsonDocument.Parse(System.ReadOnlySpan, System.Text.Json.JsonReaderOptions, ref System.Text.Json.JsonDocument.MetadataDb, ref System.Text.Json.JsonDocument.StackRowStack)
System.Text.Json.JsonDocument.Parse(System.ReadOnlyMemory, System.Text.Json.JsonReaderOptions, byte[], System.Text.Json.PooledByteBufferWriter)
System.Text.Json.JsonDocument.Parse(System.IO.Stream, System.Text.Json.JsonDocumentOptions)
Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory.GetRootParseNode(string, System.IO.Stream)
Microsoft.Kiota.Abstractions.Serialization.ParseNodeProxyFactory.GetRootParseNode(string, System.IO.Stream)
Microsoft.Kiota.Abstractions.Serialization.ParseNodeFactoryRegistry.GetRootParseNode(string, System.IO.Stream)
...
[Call Stack Truncated]`

Expected behavior

I expected any unspecified class attributes (potentially the OdataType property of ExternalItem) to be serialised as nulls or empty strings but it appears like it's perhaps not and leaving a hole in the json to make it invalid. That's my read on it anyway but as you can tell by the fact I'm following a tutorial I'm not the most experienced developer.

How to reproduce

There's not really a very easy way to provide the code for this sorry.

Any help much appreciated! Thanks so much

@petersmithfromengland petersmithfromengland added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels May 13, 2024
@petersmithfromengland
Copy link
Author

Just closing this out.

I identified the problem as being in my model where I had a property of Int64 data type. Even though my schema was configured to take a data type of Int64 for whatever reason when I tried to upload an item it must have been returning a null and punching a hole in my json, making it invalid.

Not sure if that makes any sense at all. I can elaborate and provide an example if that helps anyone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant