compute-starter-kit-assemblyscript-default icon indicating copy to clipboard operation
compute-starter-kit-assemblyscript-default copied to clipboard

`abort: Failed to construct 'URL': Invalid URL in ~lib/@fastly/as-url/util.ts(15:3)`

Open barrucadu opened this issue 4 years ago • 5 comments

I've just tried to use this starter kit locally:

$ fastly compute init
$ fastly compute build
$ fastly compute serve

It inits and builds properly, and starts to serve, but if I visit localhost:7676 the process prints an error:

✓ Initializing...
✓ Verifying package manifest...
✓ Verifying local assemblyscript toolchain...
✓ Building package using assemblyscript toolchain...
✓ Creating package archive...

SUCCESS: Built assemblyscript package assemblyscript (pkg/assemblyscript.tar.gz)

✓ Initializing...
✓ Checking latest Viceroy release...
✓ Checking installed Viceroy version...
✓ Running local server...

Jul 29 12:42:01.973  WARN no backend definitions found in /home/barrucadu/govuk/compute-at-edge-experiment/assemblyscript/fastly.toml
Jul 29 12:42:01.992  INFO Listening on http://127.0.0.1:7676
Jul 29 12:42:10.787  INFO request{id=0}: handling request GET http://localhost:7676/
abort: Failed to construct 'URL': Invalid URL in ~lib/@fastly/as-url/util.ts(15:3)
Jul 29 12:42:10.788 ERROR request{id=0}: WebAssembly trapped: exit with invalid exit status outside of [0..126)
wasm backtrace:
    0:  0x728 - <unknown>!<wasm function 28>
    1: 0x261f - <unknown>!<wasm function 85>
    2: 0x3712 - <unknown>!<wasm function 99>
    3: 0x40f2 - <unknown>!<wasm function 113>
    4: 0x453e - <unknown>!<wasm function 116>

Jul 29 12:42:10.788  INFO request{id=0}: request completed using 65.5 KB of WebAssembly heap
Jul 29 12:42:10.857  INFO request{id=1}: handling request GET http://localhost:7676/favicon.ico
abort: Failed to construct 'URL': Invalid URL in ~lib/@fastly/as-url/util.ts(15:3)
Jul 29 12:42:10.858 ERROR request{id=1}: WebAssembly trapped: exit with invalid exit status outside of [0..126)
wasm backtrace:
    0:  0x728 - <unknown>!<wasm function 28>
    1: 0x261f - <unknown>!<wasm function 85>
    2: 0x3712 - <unknown>!<wasm function 99>
    3: 0x40f2 - <unknown>!<wasm function 113>
    4: 0x453e - <unknown>!<wasm function 116>

Jul 29 12:42:10.858  INFO request{id=1}: request completed using 65.5 KB of WebAssembly heap
^C
ERROR: error during execution process:
abort: Failed to construct 'URL': Invalid URL in ~lib/@fastly/as-url/util.ts(15:3)
Jul 29 12:42:10.788 ERROR request{id=0}: WebAssembly trapped: exit with invalid exit status outside of [0..126)
wasm backtrace:
    0:  0x728 - <unknown>!<wasm function 28>
    1: 0x261f - <unknown>!<wasm function 85>
    2: 0x3712 - <unknown>!<wasm function 99>
    3: 0x40f2 - <unknown>!<wasm function 113>
    4: 0x453e - <unknown>!<wasm function 116>

abort: Failed to construct 'URL': Invalid URL in ~lib/@fastly/as-url/util.ts(15:3)
Jul 29 12:42:10.858 ERROR request{id=1}: WebAssembly trapped: exit with invalid exit status outside of [0..126)
wasm backtrace:
    0:  0x728 - <unknown>!<wasm function 28>
    1: 0x261f - <unknown>!<wasm function 85>
    2: 0x3712 - <unknown>!<wasm function 99>
    3: 0x40f2 - <unknown>!<wasm function 113>
    4: 0x453e - <unknown>!<wasm function 116>.

If you believe this error is the result of a bug, please file an issue: https://github.com/fastly/cli/issues/new?labels=bug&template=bug_report.md

barrucadu avatar Jul 29 '21 11:07 barrucadu

Hi @barrucadu,

Did you edit the code of the starter kit in any way? I tried the steps you mentioned and was unable to reproduce.

If you did not edit the code, can you please share information about your system? Such as Fastly CLI version ($ fastly version) and your operating system.

Thanks!

williamoverton avatar Jul 29 '21 11:07 williamoverton

No, I haven't edited the code at all. I've built Fastly CLI 0.34.0 and Viceroy 0.2.2 from source. I'm using NixOS 21.05.

barrucadu avatar Jul 29 '21 11:07 barrucadu

I've just found that visiting http://localhost:7676 triggers the error, but going to http://127.0.0.1:7676 does not, whereas the Rust starter kit works with both of those.

barrucadu avatar Jul 29 '21 11:07 barrucadu

Ah I see, I am now able to reproduce the error.

Thank you for your bug report!

williamoverton avatar Jul 29 '21 12:07 williamoverton

Ah! So I did some research here, it looks like this is a bug in our https://www.npmjs.com/package/@fastly/as-url package.

I wrote a quick test, and I was able to reproduce. I opened an issue on our end, and start work on this.

Thank you very much @williamoverton for finding a quick workaround, and thank you @barrucadu for opening the issue! 😄

torch2424 avatar Jul 29 '21 19:07 torch2424