Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Can't resolve 'ApiClient'

Đang mở
#72 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, next.js
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi không tìm thấy module từ app/api/revalidate/route.ts với Next 13, sau đó kiểm tra next.config.js và import của cybersource-rest-client. Hoàn thành khi route API build và chạy mà không có "lỗi phân giải 'ApiClient'".

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Using the package with Next 13 causing this issue:

`Did you mean './ApiClient'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /Users/codeclouds-sourabh/Documents/essex/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/bin/node_modules, /Users/codeclouds-sourabh/Documents/essex/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/dist/node_modules, /Users/codeclouds-sourabh/Documents/essex/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/next/node_modules, /Users/codeclouds-sourabh/Documents/essex/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules, /Users/codeclouds-sourabh/Documents/essex/node_modules/.pnpm/node_modules, /Users/codeclouds-sourabh/Documents/essex).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./app/api/revalidate/route.ts

  • warn Fast Refresh had to perform a full reload due to a runtime error.`

Code Snippet

import * as cybersourceRestApi from 'cybersource-rest-client';
var instance = new cybersourceRestApi.KeyGenerationApi({ authenticationType: 'http_signature', runEnvironment: 'cybersource.environment.SANDBOX', merchantID, merchantKeyId, merchantsecretKey, keyAlias: 'testrest', keyPass: 'testrest', keyFileName: 'testrest', keysDirectory: 'Resource', enableLog: true, logFilename: 'cybs', logDirectory: '../log', logFileMaxSize: '5242880' }); var request = new cybersourceRestApi.GeneratePublicKeyRequest(); request.encryptionType = 'RsaOaep256'; request.targetOrigin = 'http://localhost:3000'; var opts: { format: any } = { format: 'jwt' }; instance.generatePublicKey(request, opts, function (error: any, data: any, response: any) { if (error) { console.log('Error : ' + error); console.log('Error status code : ' + error.statusCode); } else if (data) { console.log('Data : ' + JSON.stringify(data)); console.log('CaptureContext: ' + data.keyId); } console.log('Response : ' + JSON.stringify(response)); console.log('Response Code Of GenerateKey : ' + response['status']); console.error(error, data); }); }

Do you have any idea how to resolve this issue? Have tried altering the webpack config using next.config.js and that didn't fix anything. Any help is appreciated.

Ngôn ngữ chính
JavaScript
Star
43
Fork
66
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CyberSource/cybersource-rest-samples-node

Tất cả issue của CyberSource/cybersource-rest-samples-node

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.