Skip to main content

Does anybody know why this won’t work once it was pushed to Zapier:

const glob = require('glob');
const path = require('path');

const myResources = {};
const myTriggers = {};


glob.sync('./resources/*.js').forEach( file => {
const resource = require(path.resolve(file));

if (resource.key) {
myResourceseresource.key] = resource;
}
});


glob.sync('./triggers/*.js').forEach( file => {
const resource = require( path.resolve(file) );

if( resource.key ){
myTriggersr resource.key ] = resource;
}
});

module.exports =
{
..
resources: myResources,
triggers:myTriggers,
authentication: require('./authentication')
}

 

MyResources and myTriggers is set correct local and while running the tests, but it won’t work after the push(*), while manually building up the resources data and requiring each one manually just works fine.

 

	resources: {
test1: require('./resources/test1'),
test2: require('./resources/test2'),
...
},

 

Is it a limit within the Zapier CLI integration?

 

(*)

Following error is returned when I try to use the action:

Error: Could not find the method to call: triggers.myHook.operation.performList

Hi @DanielF - Zapier CLI performs some tree shaking when it builds the app before uploading it. So, any file that’s not imported using require will be ignored.

You can find the build output in the build/build.zip file. If you take a look inside it, you’ll not find the triggers and resources folders.

You can tell the Zapier CLI to include those folders by adding the following to the .zapierapprc file:

{
"id": your_app_id,
"key": "App...",
"includeInBuild": i
"resources/*",
"triggers/*"
]
}