winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.07k stars 198 forks source link

`cloud.Schedule` deployment error - ValidationException: Parameter ScheduleExpression is not valid #7115

Closed Chriscbr closed 2 months ago

Chriscbr commented 2 months ago

I tried this:

bring cloud;

let schedule = new cloud.Schedule(
  // Every Sunday at 12:15 UTC
  cron: "15 12 * * 0",
);

This happened:

When I deploy the app to AWS with Terraform (wing test -t tf-aws) I get:

Command failed: terraform apply -auto-approve
╷
│ Error: creating EventBridge Rule (terraform-20240911153710019600000003): operation error EventBridge: PutRule, https response error StatusCode: 400, RequestID: afc37b83-3ed2-4779-ab44-42144ba011c3, api error ValidationException: Parameter ScheduleExpression is not valid.
│
│   with aws_cloudwatch_event_rule.TestpAmo4jiVDm_env0_Schedule_AC8C9C72,
│   on main.tf.json line 39, in resource.aws_cloudwatch_event_rule.TestpAmo4jiVDm_env0_Schedule_AC8C9C72:
│   39:       }
│
╵

It looks like the generated Terraform includes the following configuration with an invalid cron:

"aws_cloudwatch_event_rule": {
  "Schedule_15669BF1": {
    "schedule_expression": "cron(15 12 ? * -1 *)"
  }
},

I expected this:

No error

Is there a workaround?

No response

Anything else?

No response

Wing Version

0.84.7

Node.js Version

20.12.2

Platform(s)

MacOS

Community Notes

monadabot commented 2 months ago

Congrats! :rocket: This was released in Wing 0.85.2.