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

fix(sdk): local bucket files can't be accessed in simulator #7143

Merged
merged 3 commits into from
Sep 18, 2024

Conversation

Chriscbr
Copy link
Contributor

@Chriscbr Chriscbr commented Sep 18, 2024

Closes #4143

#7137 added the main code structure for serving files through an express server when cloud.Bucket is locally simulated. However, existing code like the publicUrl method was still returning URLs to your file system instead of to the HTTP server. This fixes that bug.

Fixing this enables other use cases, for example allowing a web app redirect the URL from the signed URL of a file they uploaded to the actual file (if the bucket is public).

Misc:

  • Removed the constraint that publicUrl can only return URLs to existing files. I'm not sure this is a necessary requirement - the URL structure is effectively part of the contract of cloud.Bucket (for all public clouds), and checking if the key exists only hurts performance when apps are compiled to the cloud.

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label 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.

@Chriscbr Chriscbr requested a review from a team as a code owner September 18, 2024 15:23
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistance, don't hesitate to ping the relevant owner over Discord.

Topic Owner
Wing SDK and standard library @chriscbr
Wing Console @skyrpex
Wing compiler and language design @chriscbr
VSCode extension and language server @chriscbr
Wing CLI @chriscbr
Documentation @boyney123
Examples @boyney123
Wing Playground @skyrpex

@monadabot
Copy link
Contributor

monadabot commented Sep 18, 2024

Console preview environment is available at https://wing-console-pr-7143.fly.dev 🚀

Last Updated (UTC) 2024-09-18 16:22

@monadabot
Copy link
Contributor

monadabot commented Sep 18, 2024

Benchmarks

Comparison to Baseline 🟥🟥⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 59ms±0.88 66ms±1.87 +7ms (+11.78%)🟥
functions_10.test.w -t sim 515ms±13.88 533ms±15.58 +18ms (+3.44%)🟥
functions_10.test.w -t tf-aws 2220ms±29.22 2272ms±25.89 +52ms (+2.34%)⬜
jsii_small.test.w -t sim 392ms±7.51 392ms±2.44 -1ms (-0.16%)⬜
jsii_small.test.w -t tf-aws 621ms±9.62 631ms±4.08 +10ms (+1.6%)⬜
functions_1.test.w -t sim 426ms±5.56 425ms±5.52 -2ms (-0.38%)⬜
functions_1.test.w -t tf-aws 884ms±58.78 871ms±6.97 -13ms (-1.46%)⬜
empty.test.w -t sim 381ms±4.25 386ms±4.13 +5ms (+1.4%)⬜
empty.test.w -t tf-aws 615ms±5.72 621ms±2.57 +7ms (+1.1%)⬜
hello_world.test.w -t sim 422ms±6.1 425ms±4.35 +3ms (+0.66%)⬜
hello_world.test.w -t tf-aws 1512ms±9.13 1544ms±12.03 +33ms (+2.16%)⬜
jsii_big.test.w -t sim 3050ms±21 3061ms±21.27 +11ms (+0.38%)⬜
jsii_big.test.w -t tf-aws 3243ms±16.23 3198ms±12.86 -45ms (-1.4%)⬜

⬜ 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 66ms 62ms 72ms 2ms 3ms
functions_10.test.w -t sim 533ms 492ms 562ms 16ms 22ms
functions_10.test.w -t tf-aws 2272ms 2215ms 2320ms 26ms 36ms
jsii_small.test.w -t sim 392ms 386ms 398ms 2ms 3ms
jsii_small.test.w -t tf-aws 631ms 622ms 637ms 4ms 6ms
functions_1.test.w -t sim 425ms 411ms 435ms 6ms 8ms
functions_1.test.w -t tf-aws 871ms 860ms 886ms 7ms 10ms
empty.test.w -t sim 386ms 377ms 395ms 4ms 6ms
empty.test.w -t tf-aws 621ms 617ms 627ms 3ms 4ms
hello_world.test.w -t sim 425ms 415ms 433ms 4ms 6ms
hello_world.test.w -t tf-aws 1544ms 1520ms 1564ms 12ms 17ms
jsii_big.test.w -t sim 3061ms 3020ms 3090ms 21ms 30ms
jsii_big.test.w -t tf-aws 3198ms 3172ms 3224ms 13ms 18ms
Last Updated (UTC) 2024-09-18 16:27

@Chriscbr Chriscbr merged commit c90bf77 into main Sep 18, 2024
23 checks passed
@Chriscbr Chriscbr deleted the rybickic/bucket-file-serving branch September 18, 2024 16:34
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.85.10.

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

Successfully merging this pull request may close these issues.

Making the bucket serve publicUrl and signedUrl using an express server on sim target
2 participants