Microsoft MakeCode

Importing certain extension causes error

Importing certain extensions like keyboard, mouse, gamepad, etc. it causes compilation error in staticpkg hosted on github pages

steps to reproduce:

  1. follow all the steps in Local Dev Server in pxt-maker github page.
  2. use command pxt staticpkg to generate static page
  3. host the static package on github pages like here: https://suraj022.github.io/pxt-test/ (screenshots below are from localhost but it behaves the same on github page aswell)
  4. open the page stated above and create a new project then select a board eq. adafruit feather-m0-express.
  5. Go to advanced > extensions and select either keyboard, mouse or gamepad
  6. Go to javascript/python editor, click on explorer then select output on the bottom and click on output.txt
  7. there’s an error `error: pxt_modules/base/pxt-core.d.ts(1,1): error TS9043: The hex file is not available, please connect to internet and try again.

`

Not enough details to tell.

@peli I’ve updated the post please check.

If you open the JavaScript console window in the browser, you will get a detailed error message.

I had a look at the javascript console window and following is the error.

I also tried it with my aws host and same error.

can you point me in the right direction?

thanks

The editor tries to call our cloud backend api that does the native compilation. Since you are not hosted on our server, it is unavailable to you. You will need to implement this api and host on your backend.

Thanks a lot for the explanation… Is there a documentation on how to implement this api?

No docs. The client sends a complete payload of the sources and expects the compiled binary to be placed in the blob container at the SHA location. Why not using maker.makecode.com? Cloud compilation for static packages is not supported.

ah ok… I’m not using maker.makecode.com because I Have a bunch of boards with a very specific audience. And I wish to implement as a seperate instance. Is there anyway to reroute the cloud backend api to directly access your server? or host the package anyway other than using staticpkg
also, is the sourcecode of cloud backend api available?

again thanks alot for your help.

The editor will try to call the api at yourdomain/api/... so you need to make sure the requests are routed from there.
The backend is not open source.

can you point me in the direction on how can I reroute such requests ( if at all ppossible)

Thanks

It will query /api/… so your web server should see those calls on the same domain as your editor.

some one fix this error??
I´ve the same problem with the gamepad extension in maker.makecode.com with the circuit playground bluefruit.

Unfortunately there’s no way to fix this problem unless devs open-source their makecode api backend.

@suraj022 please file a bug in github.com/microsoft/pxt to document the build api. We do not have plans to open source the backend as it is specific to our cloud infrastructure, but we can documentation the protocol.