serverless-local-schedule
serverless-local-schedule copied to clipboard
Error using `timezone`
I have the following event:
service: myservice
plugins:
- serverless-python-requirements
- serverless-local-schedule
provider:
name: aws
runtime: python3.9
stage: dev
region: us-east-1
functions:
ecobiciStatus:
handler: myservice
events:
- schedule:
rate:
- cron(25 6-23 * * ? *)
- cron(5 5 * * ? *)
- cron(25 0 * * ? *)
timezone: America/Mexico_City
While trying to deploy I get the following error message:
$ sls deploy
─╯
Running "serverless" from node_modules
Environment: darwin, node 20.2.0, framework 3.31.0 (local) 3.31.0v (global), plugin 6.2.3, SDK 4.3.2
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Property 'functions[].events[].schedule.timezone' already have a definition - this property might have already been defined by the Serverless framework or one other plugin
It was working a couple of months ago, maybe an update introduced this issue?
Using [email protected]
works correctly.
@herrsergio I had the same issue after upgrading... I believe it comes from this update to serverless: https://github.com/serverless/serverless/pull/11935
Docs: https://www.serverless.com/framework/docs/providers/aws/events/schedule#use-awsschedulerschedule-instead-of-awseventrule
Anyway, the good news is we can use timezone
now without this plugin 😄
events:
- schedule:
method: scheduler
rate: cron(0 8 * * ? *)
timezone: 'America/Los_Angeles'
Hi @bhb603 We also tried to do it the same way using timezone: America/New_York. Have u tried it. Does it automatically adjust with DST and EST accordingly.
@piyush2stax I haven't tested, but I assume it should... "America/New_York" has a specific meaning in the TZ Database, which is what AWS is using, and it should account for DST.
Docs:
- https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html#time-zones
- https://www.iana.org/time-zones