Skip to main content
Best answer

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

  • January 29, 2021
  • 2 replies
  • 162 views

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.

 

​​​

Best answer by ikbelkirasanBest answer by ikbelkirasan

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

View original
Did this topic help you find an answer to your question?
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

ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Expert
  • 555 replies
  • Answer
  • January 30, 2021

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


  • Author
  • Beginner
  • 1 reply
  • January 30, 2021

That seems to have been the problem! 

Thank you!! Still getting the hang of this haha