Michał Sadowski
Michał Sadowski

Reputation: 2149

Apostrophe cms: An error occurred saving the document

In my Apostrophe app I have a page type called backend:

{% extends 'apostrophe-templates:layout.html' %}

{% block title %}{{ super() }} | Home{% endblock %}

{% block main %}
  <div class="content">
    <h1>Backend</h1>
    {{
      apos.singleton(data.page, 'Registered users', 'registered-users')
    }}
  </div>
{% endblock %}

I think it's a pretty straightforward one. in app.js I have 'registered-users-widgets': {} declared in modules, and of course, I have a module; registered-users-widgets folder with index.js and views/widget.html.

In index.js there is:

module.exports = {
    extend: 'apostrophe-widgets',
    name: 'registered-users',
    label: 'Registered users',
    contextualOnly: true

And widget.html:

<div>TEST</div>

I added new backend page, accessed it, added Registered users. It nicely displayed TEST in the right place, but soon after I got a notification An error occurred saving the document. POST to save-area returned with code 200 and response {"status":"error"}. There's no error getting thrown in the server console, I removed the page and reregistered, once by the built-in remove, second - directly on the database, but it didn't help. What am I doing wrong here?

Upvotes: 0

Views: 164

Answers (1)

Tom Boutell
Tom Boutell

Reputation: 7572

Your area name field (second argument) must be an intercap string like registeredUsers. Spaces are not permitted.

Upvotes: 1

Related Questions