-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi, I really like the idea behind this project, and found the tutorials around it very helpful, so I tried to implement it into my own project. However, I keep getting the following error when trying to run the "notion.js" script:
// console
Missing NOTION_SECRET environment variable
(node:7652) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Done
Process finished with exit code 0
I'm very certain that I've referenced to the NOTION_SECRET environment variable properly, as I get intellisense on hover. Also, this error message has been set up to run no matter the error, so it's not very accurate.
// notion.js
// @ts-check
const NotionParse = require('@kodaps/notion-parse');
const dotenv = require('dotenv');
dotenv.config();
const go = async () => {
if (process.env.NOTION_SECRET) {
await NotionParse.parseNotion(process.env.NOTION_SECRET, './src/content', [
{
databaseId: process.env.NOTION_CONTRIBUTORS_DATABASE_ID || '',
contentType: 'Contributor'
},
{
databaseId: process.env.NOTION_ALBUMS_DATABASE_ID || '',
contentType: 'Album'
},
{
databaseId: process.env.NOTION_SONGS_DATABASE_ID || '',
contentType: 'Songs'
},
], true)
} else {
console.error('Missing NOTION_SECRET environment variable');
}
};
go().then(() => {
console.log('Done');
});// contentlayer.config.ts
import { defineDocumentType, defineNestedType, makeSource } from 'contentlayer/source-files'
const Image = defineNestedType(() => ({
name: 'Image',
fields: {
src: { type: 'string', required: true },
width: { type: 'number', required: true },
height: { type: 'number', required: true }
}
}));
const Audio = defineNestedType(() => ({
name: 'Audio',
fields: {
src: { type: 'string', required: true }
}
}));
export const Contributor = defineDocumentType(() => ({
name: 'Contributor',
filePathPattern: `music/contributors/**/*.md`,
fields: {
title: { type: 'string', required: true },
firstName: { type: 'string', required: true },
lastName: { type: 'string', required: false },
role: { type: 'string', required: true },
photo: { type: 'nested', of: Image, required: false },
link: { type: 'string', required: false },
notionId: { type: 'string', required: true }
}
}));
export const Album = defineDocumentType(() => ({
name: 'Album',
filePathPattern: `music/albums/**/*.md`,
fields: {
title: { type: 'string', required: true },
releaseDate: { type: 'date', required: true },
coverArt: { type: "nested", of: Image, required: true },
notionId: { type: 'string', required: true }
}
}));
export const Song = defineDocumentType(() => ({
name: 'Song',
filePathPattern: `music/songs/**/*.md`,
fields: {
title: { type: 'string', required: true },
audio: { type: 'nested', of: Audio, required: true },
lyrics: { type: 'string', required: true },
videoId: { type: 'string', required: false },
notionId: { type: 'string', required: true },
}
}));
export default makeSource({
contentDirPath: 'src/content',
documentTypes: [Contributor, Album, Song]
});I'm not sure if I set up multiple document types correctly as this was not really shown in the tutorials. Maybe that's the issue?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels