question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2 SDK does not return page properties

See original GitHub issue

Report bugs here only for the Node JavaScript library.

If you’re having problems using Notion’s API, or have any other feedback about the API including feature requests for the JavaScript library, please email support at developers@makenotion.com.

Describe the bug When I query a page using the v2.0.0 SDK and above, the responses do not include property values. Just an ID. There’s no indication in the documentation that an extra step is required to fetch the page property values.

I’m trying to paginate through a database, but each row contains no property values. It also happens retrieving a single page. I’ll write a minimal example:

To Reproduce Node version: 16.14.0 Notion JS library version: 1.0.4

spec.js:

const { Client } = require('@notionhq/client')

const notion = new Client({ auth: process.env.NOTION_TOKEN })
const page_id = process.env.NOTION_PAGE_ID

notion.pages.retrieve({ page_id }).then((page) => {
  console.log(page.properties)
})

Result (SDK v1.0.4):

{
  Case: { id: '%3BVfS', type: 'files', files: [] },
  Guitar: { id: '%3DkPp', type: 'files', files: [ [Object] ] },
  'Made In': { id: 'O%7BaE', type: 'rich_text', rich_text: [ [Object] ] },
  State: { id: 'PQJs', type: 'rich_text', rich_text: [] },
  Serial: { id: 'WuDR', type: 'rich_text', rich_text: [ [Object] ] },
  Tags: { id: 'ii%5E%7C', type: 'multi_select', multi_select: [ [Object] ] },
  Name: { id: 'title', type: 'title', title: [ [Object] ] }
}

Result (v2.0.0):

{
  Case: { id: '%3BVfS' },
  Guitar: { id: '%3DkPp' },
  'Made In': { id: 'O%7BaE' },
  State: { id: 'PQJs' },
  Serial: { id: 'WuDR' },
  Tags: { id: 'ii%5E%7C' },
  Name: { id: 'title' }
}

Steps to reproduce the behavior: Run the above script and compare v1.0.4 to 2.0.0 output.

Expected behavior The SDK should include Notion properties on simple queries.

If this is intentional behaviour: The documentation should make this very obvious! How do I retrieve a full database in the v2 SDK?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

22reactions
cosmithcommented, Aug 3, 2022

Just to add a data point, moving from API v2022-02-22 to v2022-06-28 makes me go from 2 requests (querying a db with 108 elements to get 12 properties) to 12*108 requests, so about 1300 requests total.

Having a method to get all properties of a page would be more reasonable… I would do one request per db object.

14reactions
tomjreescommented, Aug 2, 2022

Aha. This is apparently intended behaviour! I have found a note halfway down the “page” documentation:

Property values of this page. As of version 2022-06-28, properties only contains the ID of the property; in prior versions properties contained the values as well.

If anyone else gets stuck with this, it looks like this is the way the API is designed. Github issues are probably the wrong forum for feedback about the design changes, but this is an eyebrow-raising decision if ever I’ve seen one.

Updated issue for the Notion team:

  • There’s no mention of this on the Database API documentation page. It still states that the properties field will include the property value.
  • It would be really nice if you’d extend this SDK to do some common tasks, like iterate through the rows of a database and actually get the records of the database?

I’m downgrading to the v1 SDK so I don’t have to write as much code. I guess if I want to use V2 I have to write a bunch of code to send 1 round-trip per database cell?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS SDK for Java 2.x released | AWS Developer Tools Blog
The asynchronous clients immediately return a CompletableFuture of the response, instead of blocking the thread until the response is available.
Read more >
S3.GetObject no longer returns the result as a string #1877
I'm using the GetObjectCommand with an S3Client to pull a file down from S3. In v2 of the SDK I can write response.Body.toString('utf-8')...
Read more >
Retrieve a page property item - Notion API
Retrieves a property_item object for a given page_id and property_id. Depending on the property type, the object returned will either be a value...
Read more >
Known issues with Microsoft Graph
The API call for me/joinedTeams returns only the id, displayName, and description properties of a team. To get all properties, use the Get...
Read more >
Properties: update | Drive API - Google Developers
Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found