githubocto/flat

Some runs fail: error: Expected a JavaScript or TypeScript module

weirdyang opened this issue · 12 comments

Error: Command failed: NO_COLOR=true deno run -q --allow-read --allow-write --allow-run --allow-net --allow-env --unstable post-process.js data.json
Warning Implicitly using latest version (1.0.0) for https://deno.land/x/url_join/mod.ts
error: Expected a JavaScript or TypeScript module, but identified a Unknown module. Importing these types of modules is currently not supported.
  Specifier: https://jspm.dev/npm:xlsx@0.17.5!cjs
    at https://jspm.dev/xlsx:5:25

I’m running a GitHub action to download images from an api every hour, I used the nasa image example as the template. However sometimes the run fails with this error, what could be the issue?

here’s the failed run:
https://github.com/weirdyang/causeway-image/actions/runs/1737018565
Here’s my post process script
https://github.com/weirdyang/causeway-image/blob/main/post-process.js

Hi there! Thanks for reporting this. Could you try upgrading your version of the postprocessing library to 0.0.13

So here: https://github.com/weirdyang/causeway-image/blob/main/post-process.js#L4

import { readImageFromURL, readJSON, writeImage } from 'https://deno.land/x/flat@0.0.13/mod.ts';

And let us know if the error still happens for you?

I did some digging here - looks like these errors are very intermittent and fail while downloading different modules required for the xlsx import from jspm.

For example, this Action fails on https://jspm.dev/npm:@jspm/core@2/nodelibs/process
https://github.com/weirdyang/causeway-image/runs/4997125928?check_suite_focus=true

but this Action fails on https://jspm.dev/npm:@jspm/core@2/nodelibs/buffer
https://github.com/weirdyang/causeway-image/runs/4998890994?check_suite_focus=true

One other thing I noticed is that the errors appear to start ~Jan 10th, looking through the history on your repo, @dalanmiller. Looks like there was an xlsx release around the same time:

image

I pinned the xlsx import to v0.17.4
https://deno.land/x/flat@0.0.14/src/xlsx.ts#L1

I'm not positive that this will fix the error, but it might! Try bumping your flat import to 0.0.14, and we can revisit if the errors are still showing up.

Thanks for investigating @Wattenberger - I bumped to 0.0.14 and I'm still getting the same issue it seems.

Has anything changed to the Deno runtime behind the scenes?

https://github.com/dalanmiller/electricity/actions/runs/1775755781

Edit:

But oddly, it's intermittent, this recent run succeeded:
https://github.com/dalanmiller/electricity/runs/5015504616?check_suite_focus=true

Thanks, will try and report back. Fwiw I noticed the examples are also failing intermittently https://github.com/githubocto/flat-demo-bitcoin-price/actions/runs/1778265780

Thanks, will try and report back. Fwiw I noticed the examples are also failing intermittently https://github.com/githubocto/flat-demo-bitcoin-price/actions/runs/1778265780

This might have been because we hadn't updated the flat-demo-bitcoin-price to use 0.0.14 but we just did to see what happens.

Following-up @dalanmiller it doesn't seem like your action has failed in a while, is that correct ?https://github.com/dalanmiller/electricity/actions?

Also will leave a comment to follow this issue which Amelia found: SheetJS/sheetjs#2217

Just bumped to 14, fwiw didn’t get any errors the past few days with 13

I had the some error all of a sudden, looks like a bump to 0.0.14 did the trick.

Thanks for the reports y'all! Looks like runs have stopped intermittently failing 🙌 Please let us know if it starts happening again, and hopefully we can stop using jsnpm for Sheetjs soon