Search code examples
gatsbynetlifynetlify-cms

Gatsby CMS - Failed to load settings from /.netlify/identity


I've installed gastby 2 on an ubuntu 16.04 box

gatsby new netlifycms2 https://github.com/netlify-templates/gatsby-starter-netlify-cms 

without error.

However when I visit /admin and click login with netlify I get the message

Failed to load settings from /.netlify/identity

I assume I need this file but haven't found any instructions as how to install it.

I manually added a blank identity file in static/admin/.netlify/identity then ran gatsby build and gatsby serve however the error message persists

I've done some reading on authentication and backends this blog which suggests:

“Once you enable Identity services, a managed version of the GoTrue microservice lets you add user registration and management under /.netlify/identity for any Netlify site.”

I note the gotrue cms.js is installed in the admin directory and a few others

./public/admin/cms.js
./node_modules/netlify-cms/dist/cms.js
./node_modules/gatsby-plugin-netlify-cms/cms.js
./src/cms/cms.js

Is there is a bug with the netlify identity plugin that this file is not created?

 System:
    OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
    CPU: x64 Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
    Shell: 4.3.48 - /bin/bash
  Binaries:
    Node: 10.10.0 - /usr/bin/node
    Yarn: 1.9.4 - /usr/bin/yarn
    npm: 6.4.1 - /usr/bin/npm
  npmPackages:
    gatsby: ^2.0.0 => 2.0.1 
    gatsby-plugin-netlify: ^2.0.0 => 2.0.0 
    gatsby-plugin-netlify-cms: ^3.0.0 => 3.0.1 
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0 
    gatsby-plugin-sass: ^2.0.1 => 2.0.1 
    gatsby-plugin-sharp: ^2.0.5 => 2.0.5 
    gatsby-remark-images: ^2.0.1 => 2.0.1 
    gatsby-source-filesystem: ^2.0.1 => 2.0.1 
    gatsby-transformer-remark: ^2.1.1 => 2.1.2 
    gatsby-transformer-sharp: ^2.1.1 => 2.1.1 
  npmGlobalPackages:
    gatsby-cli: 2.4.1

Additionally I've cloned the https://github.com/netlify-templates/gatsby-starter-netlify-cms into gitlab however I get the same issue.


Solution

  • The Gatsby starter uses git-gateway backend for netlify-cms and expects to be hosted on the Netlify and have Netlify Identity service enabled. The Gatsby Starter project is one of the one-click templates.

    backend:
      name: git-gateway
      branch: master
    

    Netlify uses GoTrue open-source API written in golang, that can act as a self-standing API service for handling user registration and authentication.

    GoTrue is not part of the NetlifyCMS app bundle (netlify-cms.js or cms.js). When you enable identity on a Netlify site, there is an API endpoint created on the site for the /.netlify/identity endpoint. Adding an endpoint without the GoTrue API is not going to be valid.

    Git-Gateway Option

    Host the Gatsby/NetlifyCMS site on Netlify and enable Netlify Identity service through the site's admin on app.netlify.com and continue to use git-gateway.

    Self Host using GitLab

    Self host your site and change the config.yml to use the GitLab backend and use implicit grant setup

    Use your own OAuth

    Self host your site and change the config.yml to use the GitHub backend and use your own OAuth authentication