关于腾讯云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);
	  }
	)
}
相关推荐
嘟嘟太菜了16 小时前
使用阿里云试用资源快速部署web应用-dofaker为例
阿里云·云计算
菜就多练_082821 小时前
《深度学习》OpenCV 摄像头OCR 过程及案例解析
人工智能·深度学习·opencv·ocr
顶顶年华正版软件官方1 天前
IDM下载器如何下载网盘文件 IDM下载器支持哪些网盘
阿里云·腾讯云·idm
冰万森1 天前
亚马逊AI编程工具Amazon Q 和 Amazon CodeWhisperer使用教程
云计算·aws
OCR_wintone4211 天前
中安未来 OCR—— 开启高效驾驶证识别新时代
人工智能·汽车·ocr
OCR_wintone4211 天前
中安未来 OCR—— 开启文字识别新时代
人工智能·深度学习·ocr
OCR_wintone4212 天前
翔云 OCR:发票识别与验真
人工智能·深度学习·ocr
静听山水3 天前
腾讯云新开端口
云计算·腾讯云
CLOUD ACE3 天前
谷歌地图 | 3D 地图新功能:开发更简单,体验更丰富
云计算·云服务·谷歌云·谷歌地图·3d地图
OCR_wintone4213 天前
中安未来 OCR:引领智能报关新时代
ocr