Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Error using timezone #34

Open
herrsergio opened this issue May 29, 2023 · 4 comments
Open

Error using timezone #34

herrsergio opened this issue May 29, 2023 · 4 comments

Comments

@herrsergio
Copy link

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?

@herrsergio
Copy link
Author

Using [email protected]works correctly.

@bhb603
Copy link

bhb603 commented Jun 13, 2023

@herrsergio I had the same issue after upgrading... I believe it comes from this update to serverless: serverless/serverless#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'

@piyush2stax
Copy link

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.

@bhb603
Copy link

bhb603 commented Oct 25, 2023

@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:

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

No branches or pull requests

3 participants