fastly / js-compute-runtime

JavaScript SDK and runtime for building Fastly Compute applications
https://developer.fastly.com/learning/compute/javascript/
Apache License 2.0
199 stars 26 forks source link

Qwik City on Fastly #711

Open kalebpace opened 9 months ago

kalebpace commented 9 months ago

Summary

Hello 👋

I've been working on an adapter for the Qwik City meta-framework so it can be run on Compute@Edge. I wanted to open this issue to ask a few questions and socialize this work a bit in case this is helpful to anyone else.

I've run into a few missing APIs in the js-compute runtime when implementing the adapter in Qwik City's e2e integration project:

Wizer Error

``` Exception while evaluating JS: (new ReferenceError("Intl is not defined", "", 20115)) @:20115:12 @:25647:3 Error: the `wizer.initialize` function trapped Caused by: 0: error while executing at wasm backtrace: 0: 0x7ec9a5 - ! 1: 0x7ec6b7 - ! 2: 0x7edbd2 - ! 3: 0xfd6f - ! 4: 0x1043c - ! 5: 0x108b3 - ! 1: Exited with i32 exit status 1 Error: Failed to compile JavaScript to Wasm: Wizer initialization failure  ELIFECYCLE  Command failed with exit code 1. ```

Questions

I am mainly curious about:

  1. Whether these APIs are planned for the runtime
  2. How a project like https://github.com/fastly/next-compute-js might suggest solving for their unavailability

Thanks very much in advance for your time and attention to this!

JakeChampion commented 8 months ago

Hi @kalebpace,

Whether these APIs are planned for the runtime

Yes, we would like to implement these APIs

How a project like fastly/next-compute-js might suggest solving for their unavailability

I'm not sure on that one, I don't work on the next-compute-js project, if you open an issue on that project then hopefully the team their will be able to answer 🤞

kalebpace commented 8 months ago

Hey @JakeChampion, thanks for looking at this.

Yes, we would like to implement these APIs

Since there is interest here, is there a recommendation on how best to contribute/start work on these changes?

For example, the missing Intl API seems to be a flag in the spidermonkey runtime.

Would it be as simple as opening a PR with a successful build of it enabled or are there larger implications to making a change like this?