Skip to content

Underlying google libs throwing an exception #22

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

Closed
atrauzzi opened this issue Jun 3, 2021 · 3 comments · Fixed by #23
Closed

Underlying google libs throwing an exception #22

atrauzzi opened this issue Jun 3, 2021 · 3 comments · Fixed by #23

Comments

@atrauzzi
Copy link
Contributor

atrauzzi commented Jun 3, 2021

I'm getting the following exception while attempting to push a test job onto a queue:

Google\ApiCore\ValidationException with message 'Error rendering 'projects/{project=*}/locations/{location=*}/queues/{queue=*}': expected binding 'project' to match segment '{project=*}', instead got null
Provided bindings: Array
(
    [project] => 
    [location] => 
    [queue] => global
)
'
--
 <class></class>() at vendor/google/gax/src/ResourceTemplate/RelativeResourceTemplate.php:281
 <class>Google\ApiCore\ResourceTemplate\RelativeResourceTemplate</class>->renderingException() at vendor/google/gax/src/ResourceTemplate/RelativeResourceTemplate.php:132
 <class>Google\ApiCore\ResourceTemplate\RelativeResourceTemplate</class>->render() at vendor/google/gax/src/PathTemplate.php:88
 <class>Google\ApiCore\PathTemplate</class>->render() at vendor/google/cloud-tasks/src/V2/Gapic/CloudTasksGapicClient.php:237
 <class>Google\Cloud\Tasks\V2\Gapic\CloudTasksGapicClient</class>::queueName() at vendor/stackkit/laravel-google-cloud-tasks-queue/src/CloudTasksQueue.php:55
 <class>Stackkit\LaravelGoogleCloudTasksQueue\CloudTasksQueue</class>->pushToCloudTasks() at vendor/stackkit/laravel-google-cloud-tasks-queue/src/CloudTasksQueue.php:36
 <class>Stackkit\LaravelGoogleCloudTasksQueue\CloudTasksQueue</class>->push() at vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:182
 <class>Illuminate\Bus\Dispatcher</class>->pushCommandToQueue() at vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:158
 <class>Illuminate\Bus\Dispatcher</class>->dispatchToQueue() at vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:73
 <class>Illuminate\Bus\Dispatcher</class>->dispatch() at eval()'d code:1
 <class></class>eval() at vendor/psy/psysh/src/ExecutionLoopClosure.php:55
 <class></class>Psy\{closure}() at vendor/psy/psysh/src/ExecutionClosure.php:96
 <class>Psy\ExecutionClosure</class>->execute() at vendor/psy/psysh/src/Shell.php:371
 <class>Psy\Shell</class>->doInteractiveRun() at vendor/psy/psysh/src/Shell.php:342
 <class>Psy\Shell</class>->doRun() at vendor/symfony/console/Application.php:166
 <class>Symfony\Component\Console\Application</class>->run() at vendor/psy/psysh/src/Shell.php:317
 <class>Psy\Shell</class>->run() at vendor/laravel/tinker/src/Console/TinkerCommand.php:81
 <class>Laravel\Tinker\Console\TinkerCommand</class>->handle() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
 <class>Illuminate\Container\BoundMethod</class>::Illuminate\Container\{closure}() at vendor/laravel/framework/src/Illuminate/Container/Util.php:37
 <class>Illuminate\Container\Util</class>::unwrapIfClosure() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
 <class>Illuminate\Container\BoundMethod</class>::callBoundMethod() at vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
 <class>Illuminate\Container\BoundMethod</class>::call() at vendor/laravel/framework/src/Illuminate/Container/Container.php:596
 <class>Illuminate\Container\Container</class>->call() at vendor/laravel/framework/src/Illuminate/Console/Command.php:134
 <class>Illuminate\Console\Command</class>->execute() at vendor/symfony/console/Command/Command.php:256
 <class>Symfony\Component\Console\Command\Command</class>->run() at vendor/laravel/framework/src/Illuminate/Console/Command.php:121
 <class>Illuminate\Console\Command</class>->run() at vendor/symfony/console/Application.php:971
 <class>Symfony\Component\Console\Application</class>->doRunCommand() at vendor/symfony/console/Application.php:290
 <class>Symfony\Component\Console\Application</class>->doRun() at vendor/symfony/console/Application.php:166
 <class>Symfony\Component\Console\Application</class>->run() at vendor/laravel/framework/src/Illuminate/Console/Application.php:93
 <class>Illuminate\Console\Application</class>->run() at vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:129
 <class>Illuminate\Foundation\Console\Kernel</class>->handle() at artisan:35

I've configured everything as best as I can infer from the home page of this project. I'm using the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to a service account key file. Everything seems to check out in that regard. I'm just not sure how or why project and location are showing up null here? My queue configs all seem to indicate that the values I've provided are present.

>>> config('queue');
=> [
     "default" => "angry",
     "connections" => [
       "angry" => [
         "driver" => "angry",
         "queue" => "default",
       ],
       "global" => [
         "driver" => "cloudtasks",
         "project" => "my-project",
         "location" => "us-central1",
         "handler" => "https://my-cloud-run-service-nn.a.run.app/handle-task",
         "queue" => "global",
         "service_account_email" => "[email protected]",
       ],
       "regional" => [
         "driver" => "cloudtasks",
         "project" => "my-project",
         "location" => "us-central1",
         "handler" => "https://my-cloud-run-service-nn.a.run.app/handle-task",
         "queue" => "ca",
         "service_account_email" => "[email protected]",
       ],
     ],
     "failed" => [
       "database" => "regional",
       "table" => "failed_jobs",
     ],
   ]

Do you maybe have any suggestions on what I can look into to determine why those two values are null, despite being configured in queue.php?

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Jun 4, 2021

@marickvantuil - I managed to do a bit of local debugging just to see what is going on in the code paths, and I noticed that you hard-code the connection names in Config.php.

As you can see in my examples, I require multiple queues and will not be naming them "cloudtasks". I think the solution here would be to figure out a way to infer the correct queue name at run time vs. hard-coding them.

@marickvantuil
Copy link
Member

marickvantuil commented Jun 4, 2021

This has been fixed in a new release v2.1.2. Thanks!

@atrauzzi
Copy link
Contributor Author

atrauzzi commented Jun 5, 2021

❤️ - Thank you so much for the opportunity to contribute to your project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants