关于腾讯云ocr银行卡识别报错url_1.URL is not a constructor

使用腾讯云进行ocr银行卡识别报错url_1.URL is not a constructor的问题各位怎么解决的能否留言告知一二

在线代码调试可以,但是js使用报错url_1.URL is not a constructor

javascript 复制代码
export function ocr(dataUrl){
    //dataUrl已转换为base64
	// Depends on tencentcloud-sdk-nodejs version 4.0.3 or higher
	const tencentcloud = require("tencentcloud-sdk-nodejs-ocr");
	
	const OcrClient = tencentcloud.ocr.v20181119.Client;
	
	const SecretId = "yourSecretId"
	const SecretKey = "yourSecretKey"
	// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
	// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
	// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
	const clientConfig = {
	  credential: {
	    secretId: SecretId,
	    secretKey: SecretKey,
	  },
	  region: "ap-beijing",
	  profile: {
	    httpProfile: {
	      endpoint: "ocr.tencentcloudapi.com",
	    },
	  },
	};
	
	// 实例化要请求产品的client对象,clientProfile是可选的
	const client = new OcrClient(clientConfig);
	const params = {dataUrl};
	client.BankCardOCR(params).then(
	  (data) => {
	    console.log("suceess",data);
	  },
	  (err) => {
	    console.error("error", err);
	  }
	)
}
相关推荐
snpgroupcn2 小时前
Adobe SAP S/4HANA 升级实践:企业规模化转型关键要素
运维·adobe·云计算
weixin_307779136 小时前
基于AWS DataSync确保效率与业务连续性的混合云数据迁移方案
云计算·迁移学习·aws
@解忧杂货铺7 小时前
【百度AI】Postman调用OCR服务-解决官方教程请求失败问题
ocr
远上寒山7 小时前
DeepSeek-OCR 论文精读与实践:用“光学上下文压缩”把长文本变成图片,再由 VLM 高效还原
ocr·vllm·文档解析·deepseek·deepseek-ocr·视觉-文本压缩
Lynnxiaowen9 小时前
今天我们学习Linux架构keepalived实现LVS代理双击热备
linux·学习·架构·云计算
wanhengidc10 小时前
服务器硬盘的作用都有哪些?
运维·服务器·安全·智能手机·云计算
leaf9z11 小时前
阿里云ECS在线扩容磁盘
阿里云·云计算·shell
lin张13 小时前
云计算概念及虚拟化
云计算
翔云 OCR API14 小时前
身份证三要素实名核验API:基于OCR与可信身份认证的技术解析
ocr