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

v15rc: Error when trying to save/publish with new RTE with a large amount of text #17460

Closed
tristanjthompson opened this issue Nov 7, 2024 · 3 comments
Labels

Comments

@tristanjthompson
Copy link
Contributor

tristanjthompson commented Nov 7, 2024

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

15.0.0-rc3

Bug summary

When I add a block into the new RTE and try to save a document, I get an error.
New RTE is saving to the wrong column in the database - it's using varcharValue which is limited to 512 chars instead of textValue which uses nvarchar(max)

Specifics

No response

Steps to reproduce

Edit - ignore the below - simply try to save a long piece of text (e.g more than 512 chars) in the new RTE - see my extra comment on the issue

  • Install Umbraco using the Release Candidate Guide - note, I set it up with SQL Server Express LocalDB (this may be a factor!)
  • Create an element type
    • Name: Heading Block
    • Property1: Heading (textstring) - mandatory
    • Property2: Sub Heading (textstring) - optional
  • Update the existing "Richtext editor" datatype
    • Available Blocks to include the Heading Block & "display inline"
    • Add the "Insert block" button to the toolbar
  • Create a doctype
    • Name: Page
    • Tab: Content
      • Property: Content (Richtext Editor) - optional
    • Structure: Allow at root = true
  • Create a content item using the "Page" doctype
    • Name: Page 1
    • Content: Insert a block - "Heading block" - set the value of Heading to "Heading 1"
    • Click update to close the editor
  • Save and publish the page

Expected result / actual result

Expected result: Saves & publishes successfully
Actual: Receive an error notification saying "Unknown error. Please see the log for more details.
A fatal server error occurred. If this continues, please reach out to your administrator."

Looking in the logs, I can see this error - given it's SQL, maybe it's specific to SQL Express?

Microsoft.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated in table 'D:\\WORKING.GIT\\TRISTANJTHOMPSON\\UMBRACO-V15\\SRC\\UMBRACOV15\\UMBRACO\\DATA\\UMBRACO.MDF.dbo.umbracoPropertyData

Full exception

{"@t":"2024-11-07T15:03:21.6050440Z","@mt":"Content save operation failed","@l":"Error","@x":"Microsoft.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated in table 'D:\\WORKING.GIT\\TRISTANJTHOMPSON\\UMBRACO-V15\\SRC\\UMBRACOV15\\UMBRACO\\DATA\\UMBRACO.MDF.dbo.umbracoPropertyData', column 'varcharValue'. Truncated value: '{\"markup\":\"\\u003Cp\\u003E\\u003Cumb-rte-block-inline data-content-key=\\u002246b63ef3-4440-436f-b3c1-6d'.\r\nThe statement has been terminated.\r\n   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\r\n   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)\r\n   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)\r\n   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)\r\n   at Microsoft.Data.SqlClient.SqlCommand.ExecuteScalar()\r\n   at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)\r\n   at NPoco.Database.ExecuteScalarHelper(DbCommand cmd)\r\n   at NPoco.Database.InsertAsyncImp[T](PocoData pocoData, String tableName, String primaryKeyName, Boolean autoIncrement, T poco, Boolean sync)\r\n   at NPoco.Database.Insert[T](String tableName, String primaryKeyName, Boolean autoIncrement, T poco)\r\n   at NPoco.Database.Insert[T](T poco)\r\n   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.DocumentRepository.PersistNewItem(IContent entity)\r\n   at Umbraco.Cms.Core.Cache.DefaultRepositoryCachePolicy`2.Create(TEntity entity, Action`1 persistNew)\r\n   at Umbraco.Cms.Core.Services.ContentService.Save(IContent content, Nullable`1 userId, ContentScheduleCollection contentSchedule)\r\n   at Umbraco.Cms.Core.Services.ContentEditingService.Save(IContent content, Guid userKey)\r\nClientConnectionId:8b28b3f1-72f2-43d5-9c5f-06f0e1267ece\r\nError Number:2628,State:1,Class:16","@tr":"452a275f96c11e1f4cec0fcabe0edce4","@sp":"b52688e5ffa630c8","SourceContext":"Umbraco.Cms.Core.Services.ContentEditingService","ActionId":"700b4ba8-5cb1-4ae8-bbd9-94a15d0f6ed9","ActionName":"Umbraco.Cms.Api.Management.Controllers.Document.CreateDocumentController.Create (Umbraco.Cms.Api.Management)","RequestId":"0HN7V5UODEJCU:00000013","RequestPath":"/umbraco/management/api/v1/document","ConnectionId":"0HN7V5UODEJCU","ProcessId":39304,"ProcessName":"UmbracoV15","ThreadId":55,"ApplicationId":"fba7298e5d601f8f14775162228d60fe803d42d8","MachineName":"MANDO","Log4NetLevel":"ERROR","HttpRequestId":"1a263315-01e7-4c5f-a2ba-ae4d12d27804","HttpRequestNumber":88,"HttpSessionId":"fb23e0bc-7049-5bc7-767e-4324d7807994"}

Notification

image

Copy link

github-actions bot commented Nov 7, 2024

Hi there @tristanjthompson!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

tristanjthompson added a commit to tristanjthompson/HacktoberfestActivityLog that referenced this issue Nov 7, 2024
mikecp pushed a commit to umbraco/HacktoberfestActivityLog that referenced this issue Nov 7, 2024
@tristanjthompson
Copy link
Contributor Author

Update! Looks like this is to do with the column it's saved in being too small rather than it being specifically to do with the block.

After chatting with Ravi I had a look in the umbracoPropertyData table - I can see that the RTE is saving to the varcharValue column which is an nvarchar(512). It shold probably be saving to the textValue column which is set to nvarchar(max).

So this is likely nothing to do with blocks, but maximum length of the data being stored.

To verify this, I removed the block and added a long chunk of text longer than 512 chars and could see the same error when I tried to save.

SQL Table

image

Saving with large chunk of text

image

@tristanjthompson tristanjthompson changed the title v15rc: Error when trying to save/publish with new RTE + inserted block v15rc: Error when trying to save/publish with new RTE with a large amount of textx Nov 7, 2024
@tristanjthompson tristanjthompson changed the title v15rc: Error when trying to save/publish with new RTE with a large amount of textx v15rc: Error when trying to save/publish with new RTE with a large amount of text Nov 7, 2024
@bergmania
Copy link
Member

Thanks for reporting. This is also fixed in #17430. I just confirmed i cannot reproduce after this change, but can before.

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

No branches or pull requests

2 participants