Node to JavaScript Query

How can i import Google-AUTH library in my JavaScript code.
This is the node.js code I am trying in run in JavaScript query in retool
const {GoogleAuth} = require('google-auth-library');
const auth = new GoogleAuth();

Below is the error i am getting:
Module name "google-auth-library" has not been loaded yet for context: _. Use require([]) Common Errors

Hi @mohit :wave:

Welcome to the community! We have docs for importing custom JS libraries here: https://docs.retool.com/docs/custom-js-code

What is your use case? I'm curious if it would be helpful to use a REST API resource https://docs.retool.com/docs/apis

Hi @Tess,

some libraries like google-auth-library don't have UMD builds so we cannot import them properly. We need to use the require method to import it otherwise it won't work. Same kind of issue with node-vault

Hi @philippe-boyd-maxa Thanks for this clarification! Unfortunately for libraries that don't have a UMD build, they won't be compatible with Retool.

Since require is a node functionality, and this code is run in the browser, there is a fundamental incompatibility.