Skip to content
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

Schedule rate "cron" not yet supported! #1044

Closed
shellscape opened this issue Jul 16, 2020 · 19 comments
Closed

Schedule rate "cron" not yet supported! #1044

shellscape opened this issue Jul 16, 2020 · 19 comments

Comments

@shellscape
Copy link

Bug Report

Current Behavior

Using the following configuration results in an error message: schedule rate "cron" not yet supported!

Sample Code

  • file: serverless.yml
      - schedule:
          name: Monthly
          rate: cron(0 1 10 18 1/1 ? *) # Monthly, the 18th at Midnight UTC-10 (Hawaii)
          enabled: true
          input:
            fequency: 'monthly'

Expected behavior/code

My expectation was that I would not receive an error message.

Environment

  • serverless version: 1.67.3
  • serverless-offline version: 6.1.4
  • node.js version: 14.0.0
  • OS: macOS 10.15.2

Possible Solution

It looks like a solution was commented out in this commit 1c29984 and the error message was added. I wasn't able to find any context in the issues for why the change was made, the commit message contained no additional information, and there were no code comments to indicate why support was removed.

Additional context/Screenshots

@will-holley
Copy link

Hi, @dherault 👋 – Can you take a look at this and provide context? Thanks!

@gruckionvit
Copy link

@dherault Just a reminder that this one is with you. Looks like this comment was done by @dnalborczyk though.

@divillysausages
Copy link

divillysausages commented Dec 29, 2020

Is there any info on this by any chance?

For info:

- schedule: rate(1 minute)

works, with the message:

Scheduling [testCronHandler] cron: [*/1 * * * *] input: undefined

but

- schedule: cron(0/1 * * * * *)

gives the messages

schedule rate "cron" not yet supported!
scheduler: invalid, schedule syntax
Scheduling [testCronHandler] cron: [undefined] input: undefined

I'm assuming because only basic cron syntax is supported ("every X")?

@mrfrase3
Copy link

mrfrase3 commented Mar 8, 2021

I took a brief look into this so I could carry on. It looks like the schedule code was influenced by the now-unsupported serverless-offline-scheduler plugin, which did support cron.

Looking at the file events/schedule/Schedule.js file, as mentioned by the OP, it looks like the code for corn support was copied over but then commented out for some probably valid reason. Uncommenting it fixed the issue.

I wrote a patch to uncomment cron support, you can find it in the attached zip, just put the patches folder into your project root, install patch-package, and re-install your dependencies.

Warning: Use this patch at your own risk, this code was likely commented out because something is broken, hence why I'm not fixing it with a PR.
serverless-offline-cron-patch.zip

@alissonssz
Copy link

alissonssz commented Mar 9, 2021

Is there any info on this by any chance?

For info:

- schedule: rate(1 minute)

works, with the message:

Scheduling [testCronHandler] cron: [*/1 * * * *] input: undefined

but

- schedule: cron(0/1 * * * * *)

gives the messages

schedule rate "cron" not yet supported!
scheduler: invalid, schedule syntax
Scheduling [testCronHandler] cron: [undefined] input: undefined

I'm assuming because only basic cron syntax is supported ("every X")?

The same thing is happining to me. Is there any PR to fix this?

@shellscape
Copy link
Author

I opened this issue coming up on a year ago now. for those running across this issue via Google and such, I don't have any faith that it will ever be addressed. maintainers have not responded to it, so I have to assume they have no interest in it. we have since stopped using serverless and have started using the CDK as a far better alternative.

@DJAlPee
Copy link

DJAlPee commented Mar 17, 2021

I opened this issue coming up on a year ago now. for those running across this issue via Google and such, I don't have any faith that it will ever be addressed. maintainers have not responded to it, so I have to assume they have no interest in it. we have since stopped using serverless and have started using the CDK as a far better alternative.

I feel your pain...
How did you implement the offline functionality in CDK?

@omar-dulaimi
Copy link

Any update on this?

1 similar comment
@joaoeliandro
Copy link

Any update on this?

@LanPRD
Copy link

LanPRD commented Sep 16, 2021

Debugging with this command works for me:

sls schedule

My serverless.yml:

functionName:
handler: handlers/path.functionName
timeout: 100
events:
  - schedule: cron(0/1 * * * ? *)

My package.json:

"aws-sdk": "^2.987.0",
"serverless": "^2.57.0",
"serverless-jetpack": "^0.11.1",
"serverless-offline": "^8.1.0",
"serverless-offline-scheduler": "^0.5.0",
"serverless-plugin-common-excludes": "^4.0.0"

@BhuvaneshwaranR
Copy link

You might've got the below error/warning message

schedule rate "cron" not yet supported!
scheduler: invalid, schedule syntax

@bfaulk96
Copy link

bfaulk96 commented Feb 1, 2022

Is there any plan to add cron support to the main package without the patch mentioned above?

@pgrzesik
Copy link
Collaborator

pgrzesik commented Feb 2, 2022

There is no active work on that but PRs are welcome 💯

@gustavorps
Copy link

+1

@geoffmanningcleartrace
Copy link
Contributor

geoffmanningcleartrace commented Apr 7, 2022

@pgrzesik , i humbly ask that you consider this pull request to resolve this issue:
#1364

@geoffmanningcleartrace
Copy link
Contributor

It's been almost 3 weeks, and i've gotten two approvals from devs that don't have permission to push, but no attention from any of the maintainers that do. Starting to wonder if this is a dying project, maybe it's time to fork off and maintain it. The organization i work for is heavily invested in serverless, and am fairly certain our CTO would agree to maintain a public repo forking this one for the benefit of others. If there's any interest i'll see what i can do.

@mrfrase3
Copy link

Hey, whilst that sounds good, it might be better to move that kind of conversation to a more appropriate thread (I've been getting notifications on this issue for a year now)

It looks like @dherault discussed this issue in #304

@geoffmanningcleartrace
Copy link
Contributor

geoffmanningcleartrace commented Apr 27, 2022

Hey, whilst that sounds good, it might be better to move that kind of conversation to a more appropriate thread (I've been getting notifications on this issue for a year now)

The conversation IS directly related to the resolution of this specific issue. You know there is a "Unsubscribe" button in the right hand pane under Notifications if you yourself are done w this issue getting resolved. (Try Ctrl+F on Windows, or Cmd+F on a Mac and search for "Unsubscribe" if you're having a hard time finding it). I do appreciate you bringing up issue #304, tho, i'll see if i can simply be given maintainer status so we can get this issue pushed through.

@dnalborczyk
Copy link
Collaborator

released as part of v8.8.0

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

No branches or pull requests