MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Stitch error for using Axios and Handlebar node modules

Hello,

I have been try to use MongoDB Stitch to do some sever-less work pretty simple but without success.

I would like to ask to see if there is any workaround I can take.

  1. Http Request lib axios failed

My goal is to use Ghost Blog provided JavaScript client to create article when there is a new data insert to MongoDB.

The error I got from trigger is:

Error: StitchError: TypeError: ‘adapter’ is not a function"

I searched online, this is an error from axios which I believe Ghost Client use this to send http request under the hood.

  1. Handlebar failed
    I use Handlebar to generate a HTML code, and this also failed with error message:
    failed to execute source for ‘handlebars’: failed to execute source for ‘node_modules/handlebars/dist/cjs/handlebars’: failed to execute source for ‘node_modules/handlebars/dist/cjs/handlebars.runtime’: ReferenceError: ‘window’ is not defined

My question is axios module is a popular http module used in nodejs world. Is this not supported in Stitch or I did something wrong?

I can remove the need of using Handlebar module, but if there is a way can fix it would be great.

By the way:

  1. I have uploaded the module dependencies correctly.
  2. And also, the code is working on my local machine. :blush:

Thanks in advance.

Hi – We had a release on Wednesday (4/22) that enabled Axios support and we believe it also addresses the issues you ran into with Handlebars (though we haven’t tested Handlebars extensively). Please feel free to let us know if you run into any additional issues in the future!

2 Likes