Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Rollup properties are not working #270

Closed
Berdir opened this issue Jul 31, 2023 · 2 comments · Fixed by #272
Closed

[BUG] Rollup properties are not working #270

Berdir opened this issue Jul 31, 2023 · 2 comments · Fixed by #272
Labels
bug Something isn't working

Comments

@Berdir
Copy link

Berdir commented Jul 31, 2023

Describe the bug

Rollup properties are not working

To Reproduce

Load a node from a database with a rollup property, save it again:

Uncaught PHP Exception Notion\Exceptions\ApiException: "body failed validation. Fix one:
body.properties.Project type.title should be defined, instead was `undefined`.
body.properties.Project type.rich_text should be defined, instead was `undefined`.
body.properties.Project type.number should be defined, instead was `undefined`.
body.properties.Project type.url should be defined, instead was `undefined`.
body.properties.Project type.select should be defined, instead was `undefined`.
body.properties.Project type.multi_select should be defined, instead was `undefined`.
body.properties.Project type.people should be defined, instead was `undefined`.
body.properties.Project type.email should be defined, instead was `undefined`.
body.properties.Project type.phone_number should be defined, instead was `undefined`.
body.properties.Project type.date should be defined, instead was `undefined`.
body.properties.Project type.checkbox should be defined, instead was `undefined`.
body.properties.Project type.relation should be defined, instead was `undefined`.
body.properties.Project type.files should be defined, instead was `undefined`.
body.properties.Project type.status should be defined, instead was `undefined`.
body.properties.Project type.type should be not present, instead was `"rollup"`.
body.properties.Project type.rollup should be not present, instead was `{"type":"array","array":[{"type":"select","select":{"id...`.
body.properties.Project type.name should be defined, instead was `undefined`.
body.properties.Project type.start should be defined, instead was `undefined`." at /app/vendor/mariosimao/notion-sdk-php/src/Exceptions/ApiException.php line 33

Note sure what that means exactly.

Expected behavior
No error.

Code snippet
If applicable, add code snippets to help explain your problem.

Environment (please complete the following information):

  • SDK Version latest

Additional context
Add any other context about the problem here.

@Berdir Berdir added the bug Something isn't working label Jul 31, 2023
@Berdir
Copy link
Author

Berdir commented Jul 31, 2023

Workaround is to remove the property before sending:

    // Workaround for broken rollup property.
    $properties = $task_page->properties;
    unset($properties['Project type']);
    $task_page = $task_page->changeProperties($properties);

thinking about it, rollups are I guess read-only properties that you are not meant to change, so maybe you need to do something like that and remove them always from the sent properties?

@mariosimao mariosimao changed the title [BUG] [BUG] Rollup properties are not working Aug 2, 2023
@mariosimao
Copy link
Owner

Thanks for your feedback!

Fixed and released on v1.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants