menu

Canner

⚡️A Content Management Framework Canner standardized Content Management Architecture for enterprises, create custom Content Management System easy and fast.. Support us 👉https://opencollective.com/cannercms

Channels
Team

I think the Firestore integration docs are missing a step

March 16, 2019 at 3:56pm

I think the Firestore integration docs are missing a step

March 16, 2019 at 3:56pm

I followed the docs verbatium. So, I've either made a typo or your docs are missing a step.

Reproduction steps:

  • npm install -g @canner/cli
  • canner --version
3.2.13
  • mkdir author
  • cd author
  • canner init
  • Choose Blog template

Updating the Datasource:

  • yarn add firebase-admin @gqlify/server @gqlify/firestore
  • download serviceAccout from firestore
  • Update canner.server.js
const {FirestoreDataSource} = require('@gqlify/firestore');
const admin = require('firebase-admin');
const cert = require('./cert.json');
exports.common = {
hostname: 'http://localhost:3000',
}
exports.cms = {
logo: {
src: "https://cdn.canner.io/images/logo/logo-word-white.png",
width: "140px",
height: "50px",
href: "#",
backgroundColor: "#6ba4be"
},
style: {
sidebarTheme: "dark",
navbarTheme: "light",
navbarStyle: {
lineHeight: "50px",
height: "50px"
},
navbarMenuStyle: {
lineHeight: "50px"
},
sidebarMenuStyle: {
height: 'calc(100% - 50px)',
background: '#4c6574'
},
sidebarStyle: {
width: "200px",
},
theme: {
"primary-color": "#f19b90",
"btn-primary-bg": "#f19b90",
"menu-dark-item-active-bg": "#415663",
"menu-dark-bg": "#415663",
"menu-dark-color": "#eee",
// common
"border-radius-base": "3px",
// header
"layout-header-background": "#fff",
// body
"layout-body-background": "#ecf2f6"
}
},
// find more icons https://ant.design/components/icon/
sidebarMenu: [{
title: "Posts",
pathname: "posts",
icon: "read"
}, {
title: "Categories",
pathname: "categories",
icon: "tag"
}],
}
exports.graphql = {
dataSources: {
firestore: args => new FirestoreDataSource({
config: {
credential: admin.credential.cert(cert),
databaseURL: `https://${cert.project_id}.firebaseio.com`
},
collection: args.key,
}),
}
}
exports.auth = {
// mountPath?: string;
accounts: [{
username: 'canner',
password: 'canner',
}]
}

Update canner.schema.js

import CannerScript, {Body} from 'canner-script';
import Posts from './schema/posts.schema.js';
import Categories from './schema/categories.schema';
import BodyComponent from './components/layout/body';
import {ImgurStorage} from '@canner/storage';
export const imageStorage = new ImgurStorage({
clientId: 'a214c4836559c77'
});
const schema = (
<root imageStorage={imageStorage}>
<Body component={BodyComponent}>
<Posts dataSource={{name: 'firestore'}} />
<Categories dataSource={{name: 'memory'}} />
</Body>
</root>
);
export default schema;

March 18, 2019 at 7:24am

Hi, @matthewharwood, thanks for the report, did you get any error messages in the log box? I just found the dateTime field doesn't work properly, like the picture. And I want to know whether the error is same as the one in your case, or there are further one? Thanks!

  • reply
  • like
  • reply
  • like

March 22, 2019 at 4:06am

April 3, 2019 at 6:37pm

@siou I'll try a fresh run of the tutorial again on a different computer tonight; however, any update ?

  • reply
  • like

April 10, 2019 at 11:18pm

It was the node version I guess.

  • reply
  • like