Skip to main content

I am utilizing the Zapier Platform CLI Tool to build out my integration with Sage Intacct. Currently, I am attempting to unit test the authentication, and am having some difficulties using the HTTP Middleware Zapier provides. 

I’ve been following the guides pretty closely (I’ve got like 15 github tabs open), but I am running into either 1 of 2 problems. 

  1. authentication is undefined. Project is ‘Structurally Sound’.
    • zapier test --debug can’t reference the authentication.js file from index.js. It is set up exactly the same as this example. Project doesn’t work at all. Code below:
    • const {
      config: authentication,
      befores = r],
      afters = b],
      } = require('./authentication');

      module.exports = {
      version: require('./package.json').version,
      platformVersion: require('zapier-platform-core').version,

      authentication, //undefined

      /* Zapier Middleware */
      beforeRequest: ...befores],
      afterResponse: ...afters],
      };

       

  2. Project is ‘Structurally Invalid’. authentication references authentication.js. Tests are able to run. Project seems to work fine.
    • zapier test --debug works! It can reference authentication.js and run the middleware for the authentication requests. Minor edits to index.js below:
    • const {
      config: authentication,
      befores = a],
      afters = s],
      } = require('./authentication');

      module.exports = {
      version: require('./package.json').version,
      platformVersion: require('zapier-platform-core').version,

      authentication: require('./authentication'),

      /* Zapier Middleware */
      beforeRequest: /...befores],
      afterResponse: ,...afters],
      };
    • Project is ‘structurally invalid’ with the following screenshot of zapier validate --debug:

    • Validation Errors

Any ideas for how to make this work? Please let me know if I can provide more information.

 

​​​

Hi @Ethan36 - Are you positive that the authentication configuration is called config and that it is exported in authentication.js module?


That seems to have been the problem! 

Thank you!! Still getting the hang of this haha