makenotion / notion-sdk-js

Official Notion JavaScript Client
https://developers.notion.com/docs
MIT License
4.95k stars 591 forks source link

Relation property comes with no value #514

Closed vtnorton closed 3 months ago

vtnorton commented 6 months ago

Describe the bug I'm trying to catch one property of type relation but the response comes with it empty.

To Reproduce Node version: 18.18.2 Notion JS library version: 2.2.15

Steps to reproduce the behavior:

const notion = new Client({ auth: process.env.notionSecret, });

const response = await notion.databases.query({ database_id: DATABASE_ID, });

console.log("item with relation", results[0].properties.Relation);


The console log object is: 

{ id: 'XRhw', type: 'relation', relation: [], has_more: false }



This implies that I'm selecting the correct property, but the content inside `relation` is empty, while the page does contain a relation to another database.

**Expected behavior**
Expected to return the content of the relation.
vtnorton commented 3 months ago

I needed to make sure the API had access to the database via connections. That fixed the issue for me