Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
3
strickinato avatar

Thanks for putting this example up.

Something strange happened with my val that you may find interesting:

I initially was importing google from esm.

import { google } from "https://esm.sh/googleapis";

(I had created the val with townie, and this was the suggested approach)

It worked great. My cron based val worked dutifully for about a week.

However, it suddenly stopped working! It was throwing this error:

Detailed fetch error: Error: (t.fetchImplementation || le) is not a function
    at O._request (https://esm.sh/v135/gaxios@6.4.0/denonext/gaxios.mjs:16:9024)
    at eventLoopTick (ext:core/01_core.js:214:9) {
  ...
}

I'm really unsure what changed that would cause this!

  • Did the version of googleapis@latest that esm was serving change? (npm seems to suggest there hasn't been an update in months.
  • Did valtown update deno and it caused some sort of incompatability?

No idea! (Such is life in the js ecosystem I suppose...)

I found this, and started using the npm based import suggested here:

const { google } = await import("npm:googleapis");

And it works again :smile:

stevekrouse avatar

Appreciate you writing in! Glad to hear this demo helped!

We did upgrade to Deno 2.0 last week so that could be what caused it, possibly. Hard to say!

Yeah, in theory npm: or jsr: imports will be more stable than any https imports. Pinned dependencies are also more stable, so you may want to throw a version number on it.

We're working on better lockfile semantics to freeze things better even without explicit version pinning, ie implicit version pinning. The goal is that if you get your code working, it shouldn't break.

strickinato avatar

🙏 -- thanks for the response! Have a great holiday

Updated: October 23, 2023