Preview mode: allow more space in the preview data being passed on #32207
Replies: 2 comments
-
Bumping this. It seems like the 2048 limit was an arbitrary value picked in #10831 (comment) While this does prevent users from storing large amounts of data in the cookie, the 2048 is not enough for storing a JWT (signed with RS256), which seems like a pretty common case for making authenticated requests when in preview mode. Can we revisit this? |
Beta Was this translation helpful? Give feedback.
-
this limit kind of invalidate the use of setPreviewData(data,{}) where data being a blog post for example. Just a few lines of text will exceed that limit. https://nextjs.org/docs/pages/building-your-application/configuring/preview-mode#previewdata-size-limits |
Beta Was this translation helpful? Give feedback.
-
Bug report
This bug refers to the Preview Mode.
Describe the bug
When using the method
setPreviewData
withpreview
mode. There is a hard limit of 2kb for the data. When I look into the code states the following:Two things here stand as bugs for me:
setPreviewData
plus the data added by next. So, in reality, the data that can be passed by the user is way less than 2kb. Something around 1.2kb.To Reproduce
Create an API function like this for example:
Expected behavior
sePreviewData
plus the data added by next is less than 4kb, no error should be thrown and the program should proceed.Where X is
4kb - dataAddedByNext
. This can be an estimate if the data added by the next changes in size. It can also be calculated on the fly if no significant performance harm is added.Beta Was this translation helpful? Give feedback.
All reactions