-
Notifications
You must be signed in to change notification settings - Fork 17
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
Server Error - TypeError: Cannot read properties of undefined (reading 'length') #541
Comments
I did a quick debug and the error is generated here:
Being undefined then goes into error from.length |
I was unable to reproduce this. Could let me know what your theme json looks like? You can inspect that by looking at the output of the app endpoint (e.g https://js1.10up.com/wp-json/headless-wp/v1/app) in the |
Hi @nicholasio Here is how I faced this error:
Here is the output of the endpoint for 'theme.json'.settings field
Hope this helps. |
My steps are the same. This is mine endpoint: https://backend.riccardodicurti.com/wp-json/headless-wp/v1/app |
Thanks! I have a fix for this in this PR #545 I'll be doing a bit more testing and will get this ready for the next release. |
Thanks @nicholasio, we look forward to the new release 👍🏻 |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to develop, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `develop` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `develop`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @headstartwp/core@1.1.0-next.0 ### Minor Changes - df3e65c: Introduces `SafeHtml` and `HtmlDecoder` components. - d3ec9d8: Introduces the `decodeHtmlSpecialChars` function. ### Patch Changes - 24f8a99: Fix theme.json handling in `useBlockColors` and `useBlockTypography`. Thanks @riccardodicurti @dhamibirendra for [the bug report](#541). - 569662b: Improves the Next.js preview cookie handling and fixes a bug where the locale was not properly being passed from WP when previewing. First of all, it sets the preview cookie to expire within 5 minutes which aligns with the JWT token expiration. Secondly, it will narrow the cookie to the post path being previewed so that `context.preview` is not true for other paths and thus avoiding bypassing getStaticProps until the cookies are cleared (either expires or the browser closes). ## @headstartwp/next@1.1.0-next.0 ### Minor Changes - 569662b: Improves the Next.js preview cookie handling and fixes a bug where the locale was not properly being passed from WP when previewing. First of all, it sets the preview cookie to expire within 5 minutes which aligns with the JWT token expiration. Secondly, it will narrow the cookie to the post path being previewed so that `context.preview` is not true for other paths and thus avoiding bypassing getStaticProps until the cookies are cleared (either expires or the browser closes). ### Patch Changes - Updated dependencies [24f8a99] - Updated dependencies [569662b] - Updated dependencies [df3e65c] - Updated dependencies [d3ec9d8] - @headstartwp/core@1.1.0-next.0 ## @headstartwp/headstartwp@1.0.9-next.0 ### Patch Changes - 569662b: Improves the Next.js preview cookie handling and fixes a bug where the locale was not properly being passed from WP when previewing. First of all, it sets the preview cookie to expire within 5 minutes which aligns with the JWT token expiration. Secondly, it will narrow the cookie to the post path being previewed so that `context.preview` is not true for other paths and thus avoiding bypassing getStaticProps until the cookies are cleared (either expires or the browser closes).
Describe the bug
This is a practically clean installation, I only modified a few lines of css. If I create a page with title and text it works but as soon as I add an image it goes to 500.
Production: https://blog.riccardodicurti.it/chi-e-riccardo-di-curti/
Steps to Reproduce
Screenshots, screen recording, code snippet
- error Error [TypeError]: Cannot read properties of undefined (reading 'length') at __spreadArray (/Users/riccardodicurti/Documents/blog-frontend/node_modules/@headstartwp/core/dist/cjs/react/blocks/hooks/useBlockColors.js:3:66) at useBlockColors (/Users/riccardodicurti/Documents/blog-frontend/node_modules/@headstartwp/core/dist/cjs/react/blocks/hooks/useBlockColors.js:35:21) at useBlockAttributes (/Users/riccardodicurti/Documents/blog-frontend/node_modules/@headstartwp/core/dist/cjs/react/blocks/hooks/useBlockAttributes.js:30:54) at ImageBlock (/Users/riccardodicurti/Documents/blog-frontend/node_modules/@headstartwp/core/dist/cjs/react/blocks/ImageBlock.js:25:71) at renderWithHooks (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16) at renderIndeterminateComponent (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5731:15) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderNode (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12) at renderChildrenArray (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6211:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6141:7) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5971:9) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderIndeterminateComponent (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderNode (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12) at renderHostElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5642:3) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5952:5) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderIndeterminateComponent (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderForwardRef (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5859:5) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6005:11) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderNode (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12) at renderChildrenArray (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6211:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6141:7) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5971:9) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderIndeterminateComponent (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5946:7) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderNode (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6259:12) at renderHostElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5642:3) at renderElement (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5952:5) at renderNodeDestructiveImpl (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6104:11) at renderNodeDestructive (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:6076:14) at renderIndeterminateComponent (/Users/riccardodicurti/Documents/blog-frontend/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5785:7) { digest: undefined
Environment information
Error present both local and production
WordPress information
`
wp-core
version: 6.2.2
site_language: it_IT
user_language: it_IT
timezone: +00:00
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 0
default_comment_status: open
environment_type: production
user_count: 1
dotorg_communication: true
wp-paths-sizes
wordpress_path: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs
wordpress_size: 60,65 MB (63591850 bytes)
uploads_path: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content/uploads
uploads_size: 4,09 MB (4284795 bytes)
themes_path: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content/themes
themes_size: 2,52 MB (2641998 bytes)
plugins_path: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content/plugins
plugins_size: 14,82 MB (15536714 bytes)
database_size: 5,91 MB (6193152 bytes)
total_size: 87,98 MB (92248509 bytes)
wp-active-theme
name: Intentionally Blank (intentionally-blank)
version: 3.0.3
author: Nilo Velez
author_website: https://www.nilovelez.com/
parent_theme: none
theme_features: core-block-patterns, widgets-block-editor, automatic-feed-links, title-tag, post-thumbnails, custom-background, custom-logo
theme_path: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content/themes/intentionally-blank
auto_update: Disabilitato
wp-themes-inactive (1)
Twenty Twenty-Three: version: 1.1, author: il team di WordPress, Aggiornamenti automatici disabilitati
wp-plugins-active (2)
HeadstartWP: version: 1.0.8, author: 10up, Aggiornamenti automatici disabilitati
Wordfence Security: version: 7.10.0, author: Wordfence, Aggiornamenti automatici disabilitati
wp-media
image_editor: WP_Image_Editor_GD
imagick_module_version: 1690
imagemagick_version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
imagick_version: @PACKAGE_VERSION@
file_uploads: File uploads is turned off
post_max_size: 256M
upload_max_filesize: 256M
max_effective_size: 256 MB
max_file_uploads: 20
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP, XPM
ghostscript_version: unknown
wp-server
server_architecture: Linux 3.10.0-1160.83.1.el7.x86_64 x86_64
httpd_software: Apache
php_version: 8.1.17 64bit
php_sapi: fpm-fcgi
max_input_variables: 10000
time_limit: 600
memory_limit: 256M
max_input_time: 240
upload_max_filesize: 256M
php_post_max_size: 256M
curl_version: 7.64.0 OpenSSL/1.1.1n
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: true
wp-database
extension: mysqli
server_version: 10.4.27-MariaDB
client_version: mysqlnd 8.1.17
max_allowed_packet: 536870912
max_connections: 1000
wp-constants
WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content
WP_PLUGIN_DIR: /var/www/vhosts/riccardodicurti.com/subdomains/backend/httpdocs/wp-content/plugins
WP_MEMORY_LIMIT: 256M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: Non definito
DB_CHARSET: utf8
DB_COLLATE: undefined
wp-filesystem
wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
`
Code of Conduct
The text was updated successfully, but these errors were encountered: