Hi Retool Community, I'm running into an issue when trying to load a custom JavaScript library in Retool. I get this error: Encountered error in loading JS library: https://...sdk.umd.js.
The error doesn’t give any details on why it’s failing or how to fix it. The library is UMD-compliant and works fine in a regular browser, so I’m not sure what might be going wrong here.
Has anyone else run into this, or does anyone have ideas on what could be causing it? I’ve attached a screenshot of the console error for reference.
Great question, sorry you are having these issues with a custom library.
Unfortunately we do not have great error reporting for why certain libraries do not load into Retool.
Although your library is UMD-compliant there could be a number of potential causes of the library or it's dependencies not being able to integrate properly with Retool code
If you have more details on the specific library I can check with our engineering team to see if there is a known issue or if I can replicate the issue and see if we can add in integration.
It looks like you redacted the library name, if you need to keep it private you can DM me with more details on the library and I can see if there are alternatives to use or an explanation for why it is failing to load.
Imported library issues are especially tricky as the error responses do not provide details as to why the library was not imported as expected
Does the library have any further dependencies of its own that it relies on? Our code is executed in a sandbox environment where import libraries are loaded in on initial page load and have very minimal processing once they are loaded in.
In the worst case scenario where we can't figure out why your custom library isn't loading, you might need to look into alternative libraries that are older/more robust that have similar functionality
It is often tricky to figure out why a library doesn't work and there are not really tools to detect where the code executor hits an issue/error.