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

Archived users causing UserType fatal error #311

Open
benjwalker opened this issue Nov 17, 2023 · 2 comments
Open

Archived users causing UserType fatal error #311

benjwalker opened this issue Nov 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@benjwalker
Copy link

When running the below query, if the returned page is assigned to a user that's been archived it throws a fatal error "Fatal error: Uncaught ValueError: "0" is not a valid backing value for enum "Notion\Users\UserType"".

$notion = Notion::create(NOTION_SECRET);
$database = $notion->databases()->find(NOTION_WEB_TASKS_DATABASE);

$query = Query::create()
    ->changeFilter(
        CompoundFilter::and(
            TextFilter::property("Name")->contains($title),
        )
    )
    ->addSort(Sort::property("Name")->ascending())
    ->changePageSize(20);

$task = $notion->databases()->query($database, $query)->pages[0];
@benjwalker benjwalker added the bug Something isn't working label Nov 17, 2023
@mariosimao
Copy link
Owner

Hello @benjwalker I am sorry for the late reply.

Unfortunately, I do not have a Notion Pro plan to add multiple users and reproduce. Could you past the entire exception stack trace so I could understand better what is happening?

@benjwalker
Copy link
Author

Apologies for the delay also, hadn't actually received the error in a while, but just triggered it, full error I get from my script is below...

Fatal error: Uncaught ValueError: "0" is not a valid backing value for enum "Notion\Users\UserType" in /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Users/User.php:42 Stack trace: #0 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Users/User.php(42): Notion\Users\UserType::from(NULL) #1 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Pages/Properties/People.php(42): Notion\Users\User::fromArray(Array) #2 [internal function]: Notion\Pages\Properties\People::Notion\Pages\Properties\{closure}(Array) #3 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Pages/Properties/People.php(44): array_map(Object(Closure), Array) #4 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Pages/Properties/PropertyFactory.php(26): Notion\Pages\Properties\People::fromArray(Array) #5 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Pages/Page.php(93): Notion\Pages\Properties\PropertyFactory::fromArray(Array) #6 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Databases/Query/Result.php(34): Notion\Pages\Page::fromArray(Array) #7 [internal function]: Notion\Databases\Query\Result::Notion\Databases\Query\{closure}(Array) #8 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Databases/Query/Result.php(36): array_map(Object(Closure), Array) #9 /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Databases/Client.php(99): Notion\Databases\Query\Result::fromArray(Array) #10 /home/wearearise/public_html/subdomains/qb/php/classes/quickbooks.php(416): Notion\Databases\Client->query(Object(Notion\Databases\Database), Object(Notion\Databases\Query)) #11 /home/wearearise/public_html/subdomains/qb/php/classes/router.php(85): Quickbooks->update() #12 /home/wearearise/public_html/subdomains/qb/index.php(7): Router->route(Array) #13 {main} thrown in /home/wearearise/public_html/subdomains/qb/vendor/mariosimao/notion-sdk-php/src/Users/User.php on line 42

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

No branches or pull requests

2 participants