-
Notifications
You must be signed in to change notification settings - Fork 98
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
Internal error assigning bool to property expiresAt
#321
Comments
Hi @Nextra, |
Laravel Tinker REPL: >>> $client = app(MeiliSearch\Client::class)
=> MeiliSearch\Client {#3921}
>>> $key = $client->createKey(['description' => 'test', 'actions' => ['version'], 'indexes' => [], 'expiresAt' => Carbon\Carbon::now()->addDay()])
TypeError: Cannot assign bool to property MeiliSearch\Endpoints\Keys::$expiresAt of type ?DateTime
>>> $client->getKeys()
TypeError: Cannot assign bool to property MeiliSearch\Endpoints\Keys::$expiresAt of type ?DateTime
>>> collect($client->getRawKeys()['results'])->where('description', 'test')->first()
=> [
"description" => "test",
"key" => "hl8fkZip780f6a75a4f5bf3163447f065966b9906b5f9ad2fd4bf1883c5ab84d044cefcc",
"actions" => [
"version",
],
"indexes" => [],
"expiresAt" => "2022-05-03T09:32:50.753753056Z",
"createdAt" => "2022-05-02T09:32:50.761166Z",
"updatedAt" => "2022-05-02T09:32:50.761166Z",
] |
Update: The issue is not limited to the At present, this library seems to be too strict on parsing the timestamps it receives, and can break at any moment. Tinker: >>> $client = app(MeiliSearch\Client::class)
=> MeiliSearch\Client {#3921}
>>> $keys = collect($client->getRawKeys()['results']); null
=> null
>>> $keys->whereNotNull('expiresAt')->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s\Z', $k['expiresAt']) === false)->count()
=> 3518
>>> $keys->whereNotNull('expiresAt')->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s\Z', $k['expiresAt']) === false)->first()['expiresAt']
=> "2022-05-12T06:53:39.128139Z"
>>> $keys->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s.vu\Z', $k['createdAt']) === false)->count()
=> 1
>>> $keys->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s.vu\Z', $k['createdAt']) === false)->first()['createdAt']
=> "2022-05-09T05:14:58.994Z"
>>> $keys->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s.vu\Z', $k['updatedAt']) === false)->count()
=> 2
>>> $keys->filter(fn ($k) => date_create_from_format('Y-m-d\TH:i:s.vu\Z', $k['updatedAt']) === false)->first()['updatedAt']
=> "2022-05-11T04:16:15.397Z" |
Description
Calling
createKey
or even justgetKeys
fails with an error where MeiliSearch cannot assign the internalexpiresAt
property a timestamp.Abbreviated Log
Environment:
The text was updated successfully, but these errors were encountered: