Zapier Scripting Issue - Unable to locate 'moment' module

I’m attempting to utilize the Moment.js library within Zapier. The official instructions indicate it’s accessible. Nevertheless, when I include this code line:

let momentInstance = require(‘moment’);

I repeatedly encounter the following error message:

Oh no! We encountered a problem while executing the JavaScript. :frowning: Error: Cannot locate module ‘moment’

If I eliminate the declaration, I receive a ReferenceError: momentInstance is not defined error.

In Zapier, you might not need to use the standard require syntax to access built-in modules like Moment.js. They are often pre-loaded, so direct access without require might work. Try using moment() directly to see if that resolves the issue. Another thing to check is ensuring your code environment is correctly set in Zapier since the error might indicate it’s not loading the expected environment where Moment.js is available. Additionally, referring to updated documentation can clarify any recent changes to scripting practices in Zapier.

Sometimes, the issue might be due to a configuration problem in your Zapier environment. Ensure that you’re operating in the right type of workflow where custom scripts are allowed, as some Zap types might not permit full access to certain libraries. Also, consider checking any recent updates or announcements from Zapier regarding changes to library access, as they might have updated their policy on using external modules. Lastly, contacting Zapier support can be helpful as they could offer insights specific to your situation.