graphaware / neo4j-bolt-php

PHP Driver for Neo4j's Binary Protocol : Bolt
MIT License
42 stars 38 forks source link

Error 'Could not pack the value' #28

Closed tomswinkels closed 6 years ago

tomswinkels commented 6 years ago

Could not pack the value {"message":"A2 19105 Walstraat Rilland rit 20843\n\n29-05-2018 14:58:09 via monitor Jelte\n\n2029570 (Onbekend)\n1320105 Ambulance Zeeland (Connexxion Ambulancezorg) (Ambu 19-105 Goes)\n1320001 Ambulance Zeeland (Regionaal) (Lichtkrant CPA)","message_id":"1452573","posted":1527598708000} {"exception":"[object] (GraphAware\\Bolt\\Exception\\BoltInvalidArgumentException(code: 0): Could not pack the value {\"message\":\"A2 19105 Walstraat Rilland rit 20843\ \ 29-05-2018 14:58:09 via monitor Jelte\ \ 2029570 (Onbekend)\ 1320105 Ambulance Zeeland (Connexxion Ambulancezorg) (Ambu 19-105 Goes)\ 1320001 Ambulance Zeeland (Regionaal) (Lichtkrant CPA)\",\"message_id\":\"1452573\",\"posted\":1527598708000}
ikwattro commented 6 years ago

Can you create some code I can use to reproduce the issue? Thx

tomswinkels commented 6 years ago

When we run in manual we don't get an error...

$props = [
       'message' => 'A2 19105 Walstraat Rilland rit 20843\n\n29-05-2018 14:58:09 via monitor Jelte\n\n2029570 (Onbekend)\n1320105 Ambulance Zeeland (Connexxion Ambulancezorg) (Ambu 19-105 Goes)\n1320001 Ambulance Zeeland (Regionaal) (Lichtkrant CPA)',
            'message_id' => '1452573',
            'posted' => 1527598708000
        ];

        $query = "MERGE (n:TS_TelegramMessage { message_id : {message_id} })
        ON CREATE SET n += {props}, n.created = timestamp(), n.uuid = {uuid}
        ON MATCH SET n += {props}, n.changed = timestamp()
        RETURN ID(n) AS id";

        $result = $client->run($query, [
            'uuid' => (string) Str::uuid(),
            'props' => $props,
            'message_id' => (string)data_get($props,'message_id')
        ]);

This error of the job:

[2018-05-29 10:35:50] production.ERROR: Could not pack the value {"message":"A2 19156 vws rit 20816 Ambulancepost Zierikzee\n\n29-05-2018 12:35:40 via monitor Ambulance Zeeland\n\n2029568  Landelijk (Groepscode Group-1)\n1320156  Ambulance Zeeland (Regionaal)  (Onbekend)\n1320001  Ambulance Zeeland (Regionaal)  (Lichtkrant CPA)","message_id":"1451968","posted":1527590149000} {"exception":"[object] (GraphAware\\Bolt\\Exception\\BoltInvalidArgumentException(code: 0): Could not pack the value {\"message\":\"A2 19156 vws rit 20816 Ambulancepost Zierikzee\
\
29-05-2018 12:35:40 via monitor Ambulance Zeeland\
\
2029568  Landelijk (Groepscode Group-1)\
1320156  Ambulance Zeeland (Regionaal)  (Onbekend)\
1320001  Ambulance Zeeland (Regionaal)  (Lichtkrant CPA)\",\"message_id\":\"1451968\",\"posted\":1527590149000} at /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/PackStream/Packer.php:58)
[stacktrace]
#0 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/PackStream/Packer.php(207): GraphAware\\Bolt\\PackStream\\Packer->pack(Object(Illuminate\\Support\\Collection))
#1 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/PackStream/Packer.php(40): GraphAware\\Bolt\\PackStream\\Packer->packMap(Array)
#2 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/PackStream/Serializer.php(54): GraphAware\\Bolt\\PackStream\\Packer->pack(Array)
#3 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/Protocol/V1/Session.php(321): GraphAware\\Bolt\\PackStream\\Serializer->serialize(Object(GraphAware\\Bolt\\Protocol\\Message\\RunMessage))
#4 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-bolt/src/Protocol/V1/Session.php(83): GraphAware\\Bolt\\Protocol\\V1\\Session->sendMessages(Array)
#5 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-php-client/src/Connection/Connection.php(116): GraphAware\\Bolt\\Protocol\\V1\\Session->run('MERGE (n:TS_Tel...', Array, NULL)
#6 /home/forge/api.112pers.nl/vendor/graphaware/neo4j-php-client/src/Client.php(67): GraphAware\\Neo4j\\Client\\Connection\\Connection->run('MERGE (n:TS_Tel...', Array, NULL)
#7 /home/forge/api.112pers.nl/app/Gwingo/TelegramMessageMapper.class.php(159): GraphAware\\Neo4j\\Client\\Client->run('MERGE (n:TS_Tel...', Array)
#8 /home/forge/api.112pers.nl/app/Jobs/TelegramSenderJob.php(54): App\\Gwingo\\TelegramMessageMapper->merge(Object(Illuminate\\Support\\Collection))
#9 [internal function]: App\\Jobs\\TelegramSenderJob->handle()
#10 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#11 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#12 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#13 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#14 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\\Container\\Container->call(Array)
#15 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\TelegramSenderJob))
#16 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\TelegramSenderJob))
#17 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#18 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(49): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\TelegramSenderJob), false)
#19 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(83): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\RedisJob), Array)
#20 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(322): Illuminate\\Queue\\Jobs\\Job->fire()
#21 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(272): Illuminate\\Queue\\Worker->process('redis', Object(Illuminate\\Queue\\Jobs\\RedisJob), Object(Illuminate\\Queue\\WorkerOptions))
#22 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\RedisJob), 'redis', Object(Illuminate\\Queue\\WorkerOptions))
#23 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\\Queue\\Worker->daemon('redis', 'TelegramSender', Object(Illuminate\\Queue\\WorkerOptions))
#24 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(84): Illuminate\\Queue\\Console\\WorkCommand->runWorker('redis', 'TelegramSender')
#25 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()
#26 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#27 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#29 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Container/Container.php(564): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#30 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array)
#31 /home/forge/api.112pers.nl/vendor/symfony/console/Command/Command.php(251): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#32 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#33 /home/forge/api.112pers.nl/vendor/symfony/console/Application.php(865): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#34 /home/forge/api.112pers.nl/vendor/symfony/console/Application.php(241): Symfony\\Component\\Console\\Application->doRunCommand(Object(Laravel\\Horizon\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#35 /home/forge/api.112pers.nl/vendor/symfony/console/Application.php(143): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#36 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Console/Application.php(89): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#37 /home/forge/api.112pers.nl/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#38 /home/forge/api.112pers.nl/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 {main}
"} 
oberoivarun commented 6 years ago

Suddenly facing the same problem. Any solutions available?

ikwattro commented 6 years ago

Yes, one of the parameters of the query is an Illuminate Collection, thus not a valid type that can be used by the driver.

oberoivarun commented 6 years ago

I'm actually using a Carbon::now()->format('Y-m-d') as a variable. That is giving a cannot unpack error.

image

ikwattro commented 6 years ago

I believe it returns you a DateTime object.

On Fri, 1 Jun 2018 at 12:34, oberoivarun notifications@github.com wrote:

I'm actually using a Carbon::now()->format('Y-m-d') as a variable. That is giving a cannot unpack error.

[image: image] https://user-images.githubusercontent.com/13959202/40836752-7ea63186-65b5-11e8-87e2-2c8dc0a63c1d.png

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/graphaware/neo4j-bolt-php/issues/28#issuecomment-393842011, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKleXAiqEv9fzee6I0Q6gkVnIagT8pPks5t4RjIgaJpZM4URedY .

-- Christophe Willemsen | Graph Aware Limited

Phone: +44 (0) 333 444 7274 <javascript:void(0);> | Mobile: +32 (0) 489 687 208 <javascript:void(0);> christophe@graphaware.com | @graph_aware | www.graphaware.com

oberoivarun commented 6 years ago

Makes sense, i'll check my code.

tomswinkels commented 6 years ago

@ikwattro But when we use http than we don't get that error. I think there is a different between http and bolt.

ikwattro commented 6 years ago

@tomswinkels possible, the http connector transform your parameters to json, so I assume the Illuminate collection is transformed as array, hence why it works, let's say it is by luck.