Best answer

Zapier Platform CLI Middleware is making my project 'Structurally Invalid'

  • 29 January 2021
  • 2 replies
  • 135 views

Userlevel 1

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 = [],
      afters = [],
      } = 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 = [],
      afters = [],
      } = 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.

 

​​​

icon

Best answer by ikbelkirasan 30 January 2021, 08:26

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 1

That seems to have been the problem! 

Thank you!! Still getting the hang of this haha

Userlevel 7
Badge +12

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