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

Reading file Capabilities insufficient the first time #263

Closed
larsr opened this issue Aug 27, 2023 · 7 comments · Fixed by #272
Closed

Reading file Capabilities insufficient the first time #263

larsr opened this issue Aug 27, 2023 · 7 comments · Fixed by #272

Comments

@larsr
Copy link

larsr commented Aug 27, 2023

Runno is really neat! Great work!

I'm trying out the example with cat.wasi.wasm that reads two files defined in runno-file tags. It is started with autorun, and
it gets a Capabilities insufficient error, number 76. This is the error I am reporting.

But in my runno-wasi tag i also have controls so I have a Run button. When I press it and re-run, the program is able to read the file (which is the expected behaviour).

I have tried it with other wasm programs too, for example a haskell program that compiles with the new ghc with wasm32-wasi support. The first read fails, but if i restart with the Run button, it works fine.

Here is my setup:

index.html

<!DOCTYPE html>
<html>
<body>
  <script src="./bundle.js"></script>
  <runno-wasi src="./cat.wasi.wasm"
    args="/foo.txt /bar.txt"
    autorun
    controls
    >

    <runno-file path="/foo.txt">
    Hello, World!
    </runno-file>
    <runno-file path="/bar.txt">
    Lets concatenate these files.
    </runno-file>
  </runno-wasi>
</body>
</html>

main.js (that I compile to bundle.js with the nodejs program rollup)

import "@runno/runtime";

server.py that serves with the extra response headers

import http.server

class CustomHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
        self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
        super().end_headers()

if __name__ == '__main__':
    http.server.test(HandlerClass=CustomHTTPRequestHandler)
@taybenlor
Copy link
Owner

Thanks heaps for filing! There's a lot of useful detail here.

If you're able to, could I also get any error logs from the browser console and a screenshot of the network tab in the inspector showing the first request loading?

That would really help with understanding and reproducing!

@larsr
Copy link
Author

larsr commented Aug 28, 2023

@larsr
Copy link
Author

larsr commented Aug 28, 2023

Here is a packaged example.

debug.tgz

Unpack it and run cd debug; ./run.sh

$ tar tfz debug.tgz
debug/
debug/run.sh
debug/cat.wasi.wasm
debug/index.html
debug/bundle.js
debug/server.py

First run:
image

After pressing 'Run'
image

@taybenlor
Copy link
Owner

Thanks heaps! I'll do my best to look at this within the next week.

@taybenlor
Copy link
Owner

Hi! This appears to be working for me now on v0.5.4 could you check that works for you?

@larsr
Copy link
Author

larsr commented Sep 20, 2023

@taybenlor yes, now it works! Thanks!

(But I had to do npm install @runno/runtime@0.5.3 because

npm install @runno/runtime
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @runno/host@^0.5.4.

@taybenlor
Copy link
Owner

Oh awkward. I've stuffed that dependency up. I'll file that as an issue. I want to remove that dependency.

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 a pull request may close this issue.

2 participants