Ghost: Bug: Casper 2.2.0 post preview 500 error ([post.hbs] Cannot read property 'length' of undefined)

Created on 15 Apr 2018  路  4Comments  路  Source: TryGhost/Ghost

Issue Summary

Upgrading to Ghost 1.22.2 works fine with my old Casper-based theme. But when I replace that modified theme (based on casper 2.1.9) with the new Casper 2.2.0 default theme it breaks post preview in Ghost editor, returning http 500 [post.hbs] Cannot read property 'length' of undefined.

"Page" preview does not seem to be impacted, just "Post".

Steps to Reproduce

Upgrade to Ghost latest and use Casper 2.2.0.

Technical details

  • Ghost Version: master - latest commit: 1.22.2
  • Server OS: Ubuntu 16.4 LTS
  • Node Version: v6.14.1
  • Browser: Chrome, also breaks with Firefox
  • Database: MySQL
bug server / core

Most helpful comment

All 4 comments

I've been able to reproduce this issue and narrow it down to the has helper - options.data contains an author instead of authors key

Based on this, this issue doesn't seem to be casper-specific

I'm not exactly sure how to fix this, but I can definitely help out w/ some guidance!


Example options.data output

{ uuid: '422e202b-78aa-42ca-9638-4648a92b2cb4',
id: '5ad2b9cc0165c40046596c82',
title: '(Untitled)',
slug: 'untitled',
html: '<div class="kg-card-markdown"></div>',
feature_image: null,
featured: false,
page: false,
status: 'draft',
locale: null,
visibility: 'public',
meta_title: null,
meta_description: null,
created_at: 2018-04-15T02:50:44.000Z,
created_by: '1',
updated_at: 2018-04-15T02:50:44.000Z,
updated_by: '1',
published_at: null,
published_by: null,
custom_excerpt: null,
codeinjection_head: '',
codeinjection_foot: '',
og_image: null,
og_title: null,
og_description: null,
twitter_image: null,
twitter_title: null,
twitter_description: null,
custom_template: null,
tags: [],
author:
{ id: '1',
name: 'Tester',
slug: 'tester',
profile_image: null,
cover_image: null,
bio: null,
website: null,
location: null,
facebook: null,
twitter: null,
accessibility: null,
locale: null,
visibility: 'public',
meta_title: null,
meta_description: null,
tour: null },
primary_author: null,
primary_tag: null,
url: '/untitled/',
comment_id: '5ad2b9cc0165c40046596c82',
secure: false }

I experience the same issue. It's telling me [post.hbs] Cannot read property 'length' of undefined.

Thanks for the report 馃憤

Fix will be released on Tuesday.

Was this page helpful?
0 / 5 - 0 ratings