I am running a Symfony 4 (PHP) application on AWS Lambda using Bref (which uses Serverless).
Bref provides a layer for Symfony's bin/console binary. The Serverless config for the Lambda function looks like this:
functions:
console:
handler: bin/console
name: 'mm-console'
description: 'Symfony 4 console'
timeout: 120 # in seconds
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer
Using the above, I can run vendor/bin/bref cli mm-console -- mm:find-matches
to run bin/console mm:find-matches
on Lambda.
What if I want to run the mm:find-matches
console command on a schedule on Lambda?
I tried this:
functions:
mm-find-matches:
handler: "bin/console mm:find-matches"
name: 'mm-find-matches'
description: 'Find mentor matches'
timeout: 120
layers:
- ${bref:layer.php-73} # PHP
- ${bref:layer.console} # The "console" layer
schedule:
rate: rate(2 hours)
However "bin/console mm:find-matches
" is not a valid handler.
How can I pass mm:find-matches
command to the bin/console
function on a schedule?