Midtrans / midtrans-nodejs-client

Official Midtrans Payment API Client for Node JS | https://midtrans.com
MIT License
181 stars 57 forks source link

[node v20.17.0 express js] Snap - CANNOT FIND MODULE #76

Closed sasakiRoo closed 3 weeks ago

sasakiRoo commented 1 month ago

saya baru pertama kali menggunakan midtrans, dan saya menggunakan node js express untuk mencobanya dengan memodifikasi kode dari dokumentasi resmi midtrans: https://docs.midtrans.com/docs/snap-snap-integration-guide. Namun, saya mendapati error: node:internal/modules/cjs/loader:1228 throw err; ^

Error: Cannot find module './SnapBiApiRequestor' Require stack:

ismailjamiljauhari commented 1 month ago

Screen Shot 2024-10-21 at 18 34 07

sasakiRoo commented 1 month ago

iyaa itu bang buat aku bingung. apa harus install module itu apa gimana? padahal aku udah berkali-kali install-uninstall midtrans-client.

const midtransClient = require('midtrans-client')
const midtransClient = require('midtrans-client').Midtrans;

pas kedua baris itu di-disabled, semua berfungsi seperti semula.

sasakiRoo commented 1 month ago

fixed, theres typo in module snapBi https://github.com/Midtrans/midtrans-nodejs-client/blob/master/lib/SnapBi/snapBi.js

uziwuzzy commented 1 month ago

bole di share lebih detail issuenya dmn ya? library versi berapa?

ismailjamiljauhari commented 1 month ago

@uziwuzzy version: 1.4.1

sasakiRoo commented 1 month ago

Because of i use this 1.4.1 version, when i push this to netlify, i got the same error. So, i created a pull request to fix the typo. I hope it will be approved.

Dear Midtrans, Please see or consider this, so you don't lose a customer from node-js side.

uziwuzzy commented 1 month ago

sorry for the error, please use other version except v1.4, you can downgrade to use v1.3 for now https://www.npmjs.com/package/midtrans-client?activeTab=versions. Will fix the release nextweek.