mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
237 stars 63 forks source link

Error: * fs in ./node_modules/@mollie/api-client/dist/mollie.esm.js #152

Closed developer-bart closed 4 years ago

developer-bart commented 4 years ago

Hi,

I'm using a Gatsby/React setup. I've added the @mollie/api-client package to my project and added the following code on the client side:

import createMollieClient from '@mollie/api-client';

const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });

I now get the following error:

This dependency was not found: * fs in ./node_modules/@mollie/api-client/dist/mollie.esm.js

Any clue what this is and how I can fix it? I tried adding fs both to my project and to the @mollie/api-client inside the node_modules folder.

Pimm commented 4 years ago

Hi Bart,

Are you using @mollie/api-client inside your Gatsby/React-app?

developer-bart commented 4 years ago

HI @Pimm,

Yes I am

Pimm commented 4 years ago

Thank you for the response.

Although this version of the library is written in JavaScript, it is still designed to run on a server (in Node.js to be specific).

This is not a shortcoming: it is by design. You will have to set up a Node.js server which runs this library, or alternatively run a PHP, Ruby, or Python server.

See this issue for more information.

I see now that this is not obvious. We should be more vocal about this. Thank you for bringing this to my attention.

developer-bart commented 4 years ago

@Pimm Thanks for your quick response. I thought the payment needed to be created on the client side. Thanks again!