metaapi / metaapi-javascript-sdk

Browser and node.js javascript SDK for MetaApi, a professional cloud forex trading API for MetaTrader platform which supports both MetaTrader MetaTrader 5 and MetaTrader 4. Free usage tier available.
https://metaapi.cloud
Other
30 stars 3 forks source link

Error when importing in a Nuxt 3 project #3

Closed GigasMesh closed 9 months ago

GigasMesh commented 9 months ago

I am using Nuxt 3.9.0 with Vite 2.0.1, Vue 3.4.3 and Node 18.18.2. I installed and imported the SDK as showed on the examples, but it shows an error while trying to import. Knowing this, I've tried a different approach, which was defining the SDK as a nuxt plugin but it keeps showing the same error.

[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'FormData') at 6230 (./metaapi.cloud-sdk:5234:71) at __webpack_require__ (./metaapi.cloud-sdk:33682:40) at 5996 (./metaapi.cloud-sdk:18340:21) at __webpack_require__ (./metaapi.cloud-sdk:33682:40) at ./metaapi.cloud-sdk:33700:27 at ViteNodeRunner.runModule (./node_modules/vite-node/dist/client.mjs:356:11) at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:340:16) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:189:14) at async ViteNodeRunner.dependencyRequest (./node_modules/vite-node/dist/client.mjs:233:12)

metaapi commented 9 months ago

Hello, did you check Vue code examples published in our repository?

GigasMesh commented 9 months ago

Hello, i installed and imported as the examples on the repository. The error occurs on the import statement.

metaapi commented 9 months ago

In order to figure out how to use the SDK with Vue.js please check this code example https://github.com/metaapi/metaapi-javascript-sdk/tree/main/examples/vue

GigasMesh commented 9 months ago

You can't close this issue as completed, you didn't even try to understand the error I am facing. I've seen and used the example codes, it contains how to install and connect with the MetaCloudApi through the sdk. But as i mentioned two times before, the error on my project is occurring on the import statement, it's not possible to try the connection showed on the example. And as you can see, in the log says that the error is occurring on your sdk, that's why i opened this issue, to try to understand what is causing this and solve it on this environment i am using which is kind different from the example, despite of the vue front end.