fix(sdk)!: change `cloud.Function` event type from `string` to `Json`
Closes #6216
BREAKING CHANGE: The input type for cloud.Function handlers has been changed from string to Json to align with the event formats used by major cloud providers like AWS, GCP, and Azure.
This is a breaking change for any existing code that assumes the input event is a string.
To migrate:
- Update
cloud.Functionhandlers to expect aJsonvalue as input instead of astring - Remove any JSON parsing logic since the input will already be parsed into a
Jsonvalue - Update any tests or invocations of
cloud.Functionto pass inJsonvalues instead ofstring
Checklist
- [x] Title matches Winglang's style guide
- [x] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added
pr/e2e-fulllabel if this feature requires end-to-end testing
By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.
Thanks for opening this pull request! :tada: Please consult the contributing guidelines for details on how to contribute to this project. If you need any assistence, don't hesitate to ping the relevant owner over Discord.
| Topic | Owner |
|---|---|
| Wing SDK and utility APIs | @chriscbr |
| Wing Console | @ainvoner, @skyrpex, @polamoros |
| JSON, structs, primitives and collections | @hasanaburayyan |
| Platforms and plugins | @hasanaburayyan |
| Frontend resources (website, react, etc) | @tsuf239 |
| Language design | @chriscbr |
| VSCode extension and language server | @markmcculloh |
| Compiler architecture, inflights, lifting | @yoav-steinberg |
| Wing Testing Framework | @tsuf239 |
| Wing CLI | @markmcculloh |
| Build system, dev environment, releases | @markmcculloh |
| Library Ecosystem | @chriscbr |
| Documentation | @hasanaburayyan |
| SDK test suite | @tsuf239 |
| Examples | @hasanaburayyan |
| Wing Playground | @eladcon |
Please add a detailed description and a BREAKING CHANGE section to the PR description
The function invocation on AWS works now.
❯ aws lambda invoke --function-name Function-c852aba6 --payload $(echo '{ "foo": 123 }' | base64) out.json
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
Hi,
This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community discord at winglang.discord.com. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!
Hi,
This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community Discord. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!
Hi Gary, do you need any help with this one? Can you please resolve the conflicts?
I resolved the conflicts, but I don't have much knowledge on how the simulator resources work. Some of them require type adjusting.
it seems like there are many compilation errors:
I think you can reproduce it by running "pnpm run compile" at the SDK folder
Hey Gary, I wanted to give a heads up I've started working on update this PR and fix up some of the remaining tests. Stay tuned!
Console preview environment is available at https://wing-console-pr-6219.fly.dev :rocket:
Last Updated (UTC) 2024-07-16 20:41
Hi,
This PR has not seen activity in 20 days. Therefore, we are marking the PR as stale for now. It will be closed after 7 days. If you need help with the PR, do not hesitate to reach out in the winglang community Discord. Feel free to re-open this PR when it is still relevant and ready to be worked on again. Thanks!
@Chriscbr , @garysassano - what is the status of this one?
@revitalbarletz A few other features got bumped up in priority so I had to put my work on this on pause, but I'm aiming to update the PR and try doing some more testing for it later this week.
:x: Unstable Self-Mutation :x:
Self-mutation has run twice in a row. There may be a something non-deterministic in the build or test process. Check the last mutation commit (1a232aeb1ee3b58e0cbcdc0491322e9c9ccb9a5c) for suspicious changes. This is typically caused by:
- Absolute paths
- Timestamps
- Random values
- Flakey tests (relying on one of the above)
SDK spec tests: https://github.com/winglang/wing/actions/runs/9913437025
Attempt fixing Azure tests: https://github.com/winglang/wing/actions/runs/9914506779
Benchmarks
Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🟥⬜
| Benchmark | Before | After | Change |
|---|---|---|---|
| version | 58ms±0.36 | 58ms±0.83 | 0ms (-0.03%)⬜ |
| functions_10.test.w -t sim | 523ms±16.7 | 506ms±20.36 | -17ms (-3.21%)⬜ |
| functions_10.test.w -t tf-aws | 2232ms±22.94 | 2208ms±20.39 | -24ms (-1.09%)⬜ |
| jsii_small.test.w -t sim | 382ms±2.49 | 389ms±2.83 | +6ms (+1.62%)⬜ |
| jsii_small.test.w -t tf-aws | 634ms±6.2 | 645ms±5.93 | +11ms (+1.74%)⬜ |
| jsii_big.test.w -t sim | 2989ms±11.83 | 3024ms±13.1 | +34ms (+1.15%)⬜ |
| jsii_big.test.w -t tf-aws | 3166ms±13.62 | 3210ms±27.9 | +44ms (+1.39%)⬜ |
| hello_world.test.w -t sim | 405ms±3.68 | 414ms±4.31 | +9ms (+2.11%)⬜ |
| hello_world.test.w -t tf-aws | 1493ms±5.84 | 1503ms±8.82 | +10ms (+0.64%)⬜ |
| empty.test.w -t sim | 366ms±2.53 | 373ms±3.84 | +7ms (+1.78%)⬜ |
| empty.test.w -t tf-aws | 620ms±2.7 | 625ms±5.73 | +5ms (+0.79%)⬜ |
| functions_1.test.w -t sim | 404ms±4.74 | 419ms±9.4 | +15ms (+3.73%)🟥 |
| functions_1.test.w -t tf-aws | 857ms±5.36 | 868ms±6.95 | +11ms (+1.3%)⬜ |
⬜ Within 1.5 standard deviations 🟩 Faster, Above 1.5 standard deviations 🟥 Slower, Above 1.5 standard deviations
Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.
Results
| name | mean | min | max | moe | sd |
|---|---|---|---|---|---|
| version | 58ms | 57ms | 60ms | 1ms | 1ms |
| functions_10.test.w -t sim | 506ms | 471ms | 548ms | 20ms | 28ms |
| functions_10.test.w -t tf-aws | 2208ms | 2165ms | 2254ms | 20ms | 29ms |
| jsii_small.test.w -t sim | 389ms | 384ms | 395ms | 3ms | 4ms |
| jsii_small.test.w -t tf-aws | 645ms | 629ms | 657ms | 6ms | 8ms |
| jsii_big.test.w -t sim | 3024ms | 2993ms | 3057ms | 13ms | 18ms |
| jsii_big.test.w -t tf-aws | 3210ms | 3156ms | 3298ms | 28ms | 39ms |
| hello_world.test.w -t sim | 414ms | 405ms | 425ms | 4ms | 6ms |
| hello_world.test.w -t tf-aws | 1503ms | 1478ms | 1519ms | 9ms | 12ms |
| empty.test.w -t sim | 373ms | 363ms | 379ms | 4ms | 5ms |
| empty.test.w -t tf-aws | 625ms | 614ms | 638ms | 6ms | 8ms |
| functions_1.test.w -t sim | 419ms | 403ms | 449ms | 9ms | 13ms |
| functions_1.test.w -t tf-aws | 868ms | 858ms | 888ms | 7ms | 10ms |
Last Updated (UTC) 2024-07-15 20:17
Thanks for contributing, @garysassano! This PR will now be added to the merge queue, or immediately merged if gary/funtion-json-handler is up-to-date with main and the queue is empty.
Congrats! :rocket: This was released in Wing 0.79.0.