Microsoft MakeCode

Server build fail (hex cache issue?)

Hi everyone,

I’m hoping to keep this as to the point as possible as I’m not entirely sure which direction to look.

@hlopezbl and I have cloned pxt pxt-common-packages and pxt-microbit and linked everything properly.
image
When we run the code locally, there is no issue. However, when we deploy to a server, there is a compilation error (more on that in a moment).

We’ve been running with different versions of pxt/pxt-microbit for over 2 years now with no issue, but it appears that everything breaks when @peli did a commit from pxt-microbit 3.022->3.023 (or even 3.1.3->3.1.4)

It appears that multi variants was set to always true at this point to make way for CODAL in V2.

For whatever reason, this breaks the ability for our deployment to work. We could be barking up the wrong tree, but what we see is that it fails when looking for a hexcache file that doesn’t exist.

Of the two hex cached files that are built when packaged, neither are the one it is looking for.
When I run locally, no issue (maybe locally does not require the hex cached files? Clearly I’m out of my element here :slight_smile: )

Any help appreciated!

Thanks,
Josh

Huh, that is some incredibly good timing, this looks like one of the issues I looked at and fixed yesterday for a similar issue occurring in the offline app: https://github.com/microsoft/pxt/pull/7764 Since it looks like you’re basing your stuff off stable3.0 I’m porting it over there in https://github.com/microsoft/pxt/pull/7751

1 Like

I love good timing! You my friend, deserve 100 internet points for that fix. Looking forward to testing this out!

So if I understand correctly, during the static package build, the wrong hex files are being generated? What exactly are the hex files used for such that the local build does not need them?

Thanks,
Josh

Not quite the wrong ones; to support v2 we need multiple hexfiles to support compiling for both the original micro:bit and the new one. It was saving the ‘main’ hexfile (v1 support) but not storing the v2 hexfile that was generated at the same time.

re: local build working but server not, if you were just doing a pxt serve then it was making a network request for them (as it would if you had extensions with c++, etc), where the staticpkg was assuming the hexfile for v2 was already made as part of the build and available on your server. (either way, the end result was most likely that it was fetching the hexfile from our cloud when you were running it locally, you should see that request pop up in the network tab if you clear the caches and try to download again.)

Ah yes, I see! Many thanks!

Thanks,
Josh

I implemented the changes in cli.ts and it worked perfectly. Thanks!

Josh

1 Like