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

feat(runtime,serverless,cli): support CompressionStream & DecompressionStream APIs #932

Merged
merged 17 commits into from
Jun 24, 2023

Conversation

akitaSummer
Copy link
Contributor

@changeset-bot
Copy link

changeset-bot bot commented Jun 5, 2023

🦋 Changeset detected

Latest commit: 54c90f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@lagon/js-runtime Patch
@lagon/runtime Patch
@lagon/cli Patch
@lagon/serverless Patch
@lagon/docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 24, 2023 0:50am

@vercel
Copy link

vercel bot commented Jun 5, 2023

@akitaSummer is attempting to deploy a commit to the Lagon Team on Vercel.

A member of the Team first needs to authorize it.

@akitaSummer
Copy link
Contributor Author

@QuiiBz This feature has been developed and there shouldn't be too many issues. If you have some free time, can you prioritize code review

@QuiiBz
Copy link
Member

QuiiBz commented Jun 21, 2023

@QuiiBz This feature has been developed and there shouldn't be too many issues. If you have some free time, can you prioritize code review

I've completely forgotten this PR, sorry. I'm currently on vacation so having a bit more time than usual, will review soon.

Copy link
Member

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this PR, and apologize for the late review!

@akitaSummer
Copy link
Contributor Author

I can't seem to run any of the tests locally. Could it be because of my Rust version?

akitasummer@akitasummer'sMacBook-Pro lagon % rustc --version
rustc 1.70.0 (90c541806 2023-05-31)
thread 'response_json' panicked at 'RunResult is not a Response: Error("Value is not of type 'Array'")', crates/runtime_http/src/lib.rs:54:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
   1: core::panicking::panic_fmt
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
   2: lagon_runtime_http::RunResult::as_response
             at /Users/akitasummer/rust/lagon/crates/runtime_http/src/lib.rs:54:9
   3: fetch::utils::assert_response::{{closure}}
             at ./tests/utils/mod.rs:181:18
   4: fetch::response_json::{{closure}}
             at ./tests/fetch.rs:285:5
   5: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/future/future.rs:125:9
   6: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:541:57
   7: tokio::runtime::coop::with_budget
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/coop.rs:102:5
   8: tokio::runtime::coop::budget
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/coop.rs:68:5
   9: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:541:25
  10: tokio::runtime::scheduler::current_thread::Context::enter
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:350:19
  11: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:540:36
  12: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:615:57
  13: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/macros/scoped_tls.rs:61:9
  14: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:615:27
  15: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:530:19
  16: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/scheduler/current_thread.rs:154:24
  17: tokio::runtime::runtime::Runtime::block_on
             at /Users/akitasummer/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.25.0/src/runtime/runtime.rs:282:47
  18: fetch::response_json
             at ./tests/fetch.rs:280:5
  19: fetch::response_json::{{closure}}
             at ./tests/fetch.rs:261:26
  20: core::ops::function::FnOnce::call_once
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
  21: core::ops::function::FnOnce::call_once
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test response_json ... FAILED

failures:

failures:
    response_json

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 20 filtered out; finished in 0.12s

error: test failed, to rerun pass `-p lagon-runtime --test fetch`

 *  The terminal process "cargo 'test', '--package', 'lagon-runtime', '--test', 'fetch', '--', 'response_json', '--exact', '--nocapture'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

@QuiiBz
Copy link
Member

QuiiBz commented Jun 22, 2023

I can't seem to run any of the tests locally. Could it be because of my Rust version?

You might need to rebuild the js-runtime package (cd packages/js-runtime && pnpm build), and then run the serverless crate to rebuild the v8 snapshot (cd crates/serverless && cargo run). Alternatively, you can also rebuild js-runtime and then run the tests with the ignore-snapshot feature

@akitaSummer
Copy link
Contributor Author

cd packages/js-runtime && pnpm build

Thank you, the issue has been resolved.

Copy link
Member

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

I've added some documentation, more tests and also fixed the implementation in this commit (tested the same JS code on Chrome & Safari to make sure it's now the correct result)

@QuiiBz QuiiBz merged commit dd96fd0 into lagonapp:main Jun 24, 2023
This was referenced Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants