Skip to content

When Embedding tweets sometimes get Unexpected exception #21052

@Eaglef90

Description

@Eaglef90

Which Umbraco version are you using?

16.4

Bug summary

When I try to embed a tweet in an RTE using the built-in Embed function, it randomly fails, no matter which tweet I choose, with an “Unexpected exception happened while trying to get oembed markup” error. I am using the TinyMCE package on my v16 install, so I don’t know if this is a core issue, a package issue, or a Twitter issue, but what was happening every few weeks is now happening almost daily to me and it is blocking articles from getting published.

Specifics

URLs trying to embed:

https://x.com/THR/status/1995620384344080849?s=20
https://x.com/SquareEnix/status/1995780120888705216?s=20
https://x.com/sem_sep/status/1991750339427700739?s=20
https://x.com/sem_sep/status/1991749404114767914?s=20

Error generated:

`System.Text.Json.JsonException: 'e' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

---> System.Text.Json.JsonReaderException: 'e' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)

at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)

at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)

at System.Text.Json.Utf8JsonReader.ReadSingleSegment()

at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)

This happens on multiple computers using different browsers on different ISPs (I have tried it from my laptop on my T-Mobile hotspot, my laptop at home on a Fiber connection, and my employee gets it from their desktop at their home on the other side of the USA)

--- End of inner exception stack trace ---

at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)

at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)

at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 json, JsonTypeInfo1 jsonTypeInfo)

at Umbraco.Cms.Infrastructure.Serialization.SystemTextJsonSerializerBase.Deserialize[T](String input)

at Umbraco.Cms.Core.Media.EmbedProviders.OEmbedProviderBase.GetJsonResponseAsync[T](String url, CancellationToken cancellationToken)

at Umbraco.Cms.Core.Media.EmbedProviders.OEmbedProviderBase.GetJsonBasedMarkupAsync(String url, Nullable1 maxWidth, Nullable1 maxHeight, CancellationToken cancellationToken)

at Umbraco.Cms.Core.Media.EmbedProviders.X.GetMarkupAsync(String url, Nullable1 maxWidth, Nullable1 maxHeight, CancellationToken cancellationToken)

at Umbraco.Cms.Core.Services.OEmbedService.GetMarkupAsync(Uri url, Nullable1 maxWidth, Nullable1 maxHeight, CancellationToken cancellationToken)`

Steps to reproduce

In the RTE, click the "embed" function from the toolbar menu.
Enter one of the URLs provided
Click "retrieve"
Get error

Expected result / actual result

I would expect the function to work and return the proper code and embed the tweet vs. throwing errors.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions