Can't resolve 'ApiClient'
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của CyberSource/cybersource-rest-samples-node
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
CyberSource/cybersource-rest-samples-node#66 · 5 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
CyberSource/cybersource-rest-samples-node#58 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
Tất cả issue của CyberSource/cybersource-rest-samples-node
Issue tương tự
-
[Website] Catalog: unknown sort value and mixed-case technology in the URL break the filtersCó thể đã có người làm @barbierajput378-pixel đã nhận hôm nay. Đang mởarea/website framework/jekyll help wanted language/css language/javascript language/markdown
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
meshery/meshery.io#3088 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
firecrawl/firecrawl-mcp-server#548 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Area:WebGL p5.js 2.0+
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
processing/p5.js#9302 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue hacktoberfest
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
wassim-azi/agy-powerline#47 ·
Maintainer thường phản hồi trong vòng 1 ngày