Registry / crm-productivity / gatsby-source-notion-database

gatsby-source-notion-database

JSON →
library0.6.9jsnpmunverified

A Gatsby source plugin that loads data from Notion databases into Gatsby's GraphQL layer. Version 0.6.9 is the latest stable release; the project has low release cadence (last update in 2021). It supports multiple database sources, optional caching (static vs dynamic), and automatically resolves relation properties. Compared to alternatives like gatsby-source-notion, this plugin offers a simpler configuration and direct table URL input, but has not been actively maintained and may lack support for newer Notion API changes.

npm install gatsby-source-notion-database
INSTALL
IMPORT
SIG · GATSBY-SOURCE-NOTI
G
gatsby-source-notion-database
crm-productivityjavascriptv0.6.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gatsby-source-notion-database
module.exports = { plugins: [{ resolve: `gatsby-source-notion-database`, options: { sourceConfig: [...] } }] }
import gatsbySourceNotionDatabase from 'gatsby-source-notion-database'
This is a Gatsby plugin, not a regular npm module; it is configured in gatsby-config.js via resolve, not imported.
all<Name>
query { allPosts { nodes { name } } }
query { allNotionPosts { ... } }
The GraphQL type is auto-generated from the 'name' option in sourceConfig; prefix 'all' is added automatically.
notionDatabase
import { useStaticQuery, graphql } from 'gatsby'; const data = useStaticQuery(graphql`{ allBooks { nodes { ... } } }`)
import { graphql } from 'gatsby-source-notion-database'
This plugin does not export any functions; use standard Gatsby queries to access data.

Configure the plugin with a Notion database table URL, then query the data in a Gatsby page using GraphQL.

// gatsby-config.js module.exports = { plugins: [ { resolve: `gatsby-source-notion-database`, options: { sourceConfig: [ { name: "books", table: "https://www.notion.so/workspace/abc123?v=xyz789", cacheType: "static" } ] } } ] }; // pages/index.js import React from "react"; import { graphql } from "gatsby"; export const query = graphql` query { allBooks { nodes { name tags } } } `; const IndexPage = ({ data }) => { return ( <ul> {data.allBooks.nodes.map(book => ( <li key={book.name}>{book.name}</li> ))} </ul> ); }; export default IndexPage;
Debug
Known issues
breakingPlugin uses old Notion API (v1) which may stop working as Notion deprecates v1.
fix
Migrate to a plugin that supports Notion API v2 or use official Notion SDK.
affects: >=0.0.0
deprecatedcacheType option is deprecated — 'static' and 'dynamic' no longer have effect.
fix
Remove cacheType from sourceConfig or leave as static.
affects: >=0.5.0
gotchaTable URL must be the full URL including view ID (?v=...). Missing view ID results in empty data.
fix
Ensure the table URL includes the '?v=...' query parameter from Notion.
affects: >=0.0.0
gotchaRelation properties may not resolve correctly if the related database is also not sourced.
fix
Source all related databases in the sourceConfig array.
affects: >=0.0.0
Errors
Common errors & fixes
Error: "gatsby-source-notion-database" threw an error while running: "Cannot read property 'results' of undefined"
Invalid or missing Notion API token (not configured).
fix
Set the environment variable NOTION_TOKEN with a valid integration token.
TypeError: sourceConfig is not iterable
sourceConfig option missing or not an array.
fix
Provide sourceConfig as an array of objects in gatsby-config.js.
GraphQL Error: Unknown type 'allBooks'
The sourceConfig 'name' does not match the query name.
fix
Ensure the name option (e.g., 'books') matches the GraphQL query prefix (allBooks).
Upgrade
Version history
0.6.9latest on npm
Audit
Dependencies
gatsbyrequiredGatsby is required as the framework; plugin only works within a Gatsby project.
@notionhq/clientrequiredNotion SDK for API calls; installed as a peer dependency.
Agent activity
45 hits · last 30 days
node
40
OpenAI (training)
2
Resources
gatsby-source-notion-database — npm install gatsby-source-notion-database · libregistry