FYI, there seems to be a global CloudFlare outage, so if you’re seeing some apps crash it may be due to that.
Specifically some of my apps that rely on cdn imports.
FYI, there seems to be a global CloudFlare outage, so if you’re seeing some apps crash it may be due to that.
Specifically some of my apps that rely on cdn imports.
ExternalError: TypeError: Failed to fetch dynamically imported module: https://cdn.skypack.dev/pin/localforage@v1.10.0-vSTz1U7CF0tUryZh6xTs/mode=imports,min/optimized/localforage.js
I’m getting this, so I assume I’m affected by the same outage. But strangely, I only get this error on my computer; it works fine on my phone. Even more strange (to me, anyway), many of my users don’t have this problem, and my app works fine for them.
Hi there,
My app started to behave strangely. In particular, I am getting the following error:
“Error instantiating “quill_3”: AttributeError: ‘Window’ object has no attribute ‘Quill’ on line 31”
Essentially, my app generates a pdf file. Wherever I have the Quill component in the PDF file, it is filled with this error. I tried cloning the app and refreshing anvil_extras, but nothing helps.
All the best,
Stevan
most anvil-extras components that use a JavaScript package will first check if it’s already loaded before falling back to a cdn.
This allows developers to opt out of cdn loading by adding the JavaScript package to their theme assets and loading it in native libraries.
In tabulator there is also the option to uncheck the cdn box in the dependency config and we will load it from theme assets for you. (we should do this for anvil-extras too
)
Related discussions:
We’ve added support for this now
if you update anvil-extras to v3.6.0 you can turn off cdn
go to settings → dependencies → anvil-extras → edit icon (
) → client config → cdn
if cdn is true (default) we will try to import from cdn, and if that fails we will fallback to theme assets
Does this mean that other dependencies can also have client configs? How would that be done and what purposes could they serve?
Yes. Though I don’t think It’s documented. And you’d have to update the yaml outside of anvil.
Take a look at this commit for the semantics: Feat: opt out of cdn loading · anvilistas/anvil-extras@36e20db · GitHub
It allows your dependency to support a configuration. As a dependency you can read the configuration when you need it.
Ahh, I got it! You just make a simple line in anvil.yaml with the type and default value, looks the same as any custom prop on a custom comp, so easy enough ![]()
config = anvil.app.get_client_config("anvil_extras")
cdn = bool(config.get("cdn", True))
So I guess once you load it you get a dictionary, right? Since you set a default value, shouldn’t cdn be there no matter what? Is it not safe to assume its there and use the normal dictionary key subscription?
yes it’s safe to assume it’s there, if it’s in your config schema.