Comments (15)
升级版本试试
npm i tenpay@latest
from node-tenpay.
@befinal 升级到最新版本后,依然出现这个问题😂
from node-tenpay.
我试了一下, API没有问题.
确认一下证书配置对了吗?
from node-tenpay.
是证书配置出错了😂,麻烦了
from node-tenpay.
本地测试和部署到测试服务器时,报了和楼主发的一模一样的错,可是我没发现证书配置有什么遗漏。
pfx: require('fs').readFileSync('./apiclient_cert.p12'), // 证书文件路径
如果我修改了路径,服务器会因为找不到文件而无法启动。
@PanZhangOne 请问当时你是如何排查的。
@befinal 我在证书配置方面是否存在遗漏。
from node-tenpay.
@lzl 我们有两个公众号证书,错误地使用了另一个
from node-tenpay.
@PanZhangOne 是微信支付的API证书,对吧。
from node-tenpay.
apiclient_cert.p12
apiclient_cert.pem
apiclient_key.pem
这三个证书,应该用哪个?
from node-tenpay.
解密 wechatpy/wechatpy#312
导入 https://www.cnblogs.com/stoneniqiu/p/5585451.html
两个法子都试过了,报错依旧。
from node-tenpay.
使用P12证书.查检证书路径是不是正确,或者使用绝对路径先尝试一下
from node-tenpay.
使用绝对路径后,依然报同样的错误。
故意改动路径,会因为找不到文件而无法运行,说明原先的相对/绝对路径是正确的。
from node-tenpay.
原因找到了。
我把源码里的 this.pfx
打出来,发现是 undefined
,说明证书压根没赋上。原因是我先把证书赋给了配置参数,再把配置参数传给 tenpay
,可能是在这个过程中出现问题了。改为初始化时直接传给 tenpay
就好了。
const config = {
appid: wechatConfig.appId,
mchid: wechatConfig.mchId,
partnerKey: wechatConfig.mchKey,
// pfx: wechatConfig.pfs, // 这样就报错
pfx: require('fs').readFileSync('./apiclient_cert.p12'), // 改为直接读取
notify_url: wechatConfig.notify_url,
refund_url: wechatConfig.refund_url,
}
from node-tenpay.
遇到相同的问题, @lzl 你的方法用了也是不行。
后来我直接在源码里面配置
在node_modules=>tenpay=>lib=>index.js文件里
this.pfx = require('fs').readFileSync('./apiclient_cert.p12');
就可以正常用了
from node-tenpay.
先使用一个变量保存文件buffer
然后再实例化试试。
空值的话应该是证书还没有读取完成就实例化了
from node-tenpay.
我今天遇到这个问题了 打印pfx是能打印东西的 虽然是乱码 找不到头绪 突发情况的
from node-tenpay.
Related Issues (20)
- 请问有考虑加入小程序登陆换取openid功能吗 HOT 2
- 请问没有使用Express和Koa也能使用吗? HOT 1
- 服务商模式生成订单,一直报 签名错误?
- 退款时 无法获取具体错误 HOT 7
- 发放代金券是微信支付代金券吗?还是商家券? HOT 2
- 证书的配置能不能分成两个参数? HOT 1
- 有出现“签名错误”的同学吗? HOT 7
- thinkjs怎么添加中间件
- 请求错误 HOT 2
- 微信退款报错 HOT 3
- express新版本中bodyParser被弃用
- 建议加上消费者投诉列表等API HOT 1
- 微信支付安全密钥如何获取? HOT 2
- 沙箱请求url有变动
- 签名错误
- 扫码模式二的回调中间件和回复
- transfers: 企业付款 关闭了
- V HOT 1
- https://github.com/yessGlory17/nft-marketplace/blob/4ea0237e289ecf6fe4b3a226843f06a07e988189/public/index.html#L4 HOT 2
- v
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-tenpay.