关于腾讯云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);
	  }
	)
}
相关推荐
xianyinsuifeng5 小时前
RAG + Code Analysis 的标准路线
数据仓库·自动化·云计算·原型模式·aws
Genie cloud5 小时前
在 Mac 上使用 Docker 安装宝塔并部署 LNMP 环境
macos·docker·容器·云计算
php_kevlin6 小时前
阿里云AI接口接口
阿里云·云计算
万博智云OneProCloud7 小时前
CloudEndure 退出中国市场之后,AWS 容灾该走向哪里?
云计算·aws
翼龙云_cloud8 小时前
亚马逊云渠道商:如何从本地环境安全访问AWS云数据库RDS?
数据库·云计算·aws
爱吃饼干的熊猫8 小时前
告别“机械扫描”:DeepSeek-OCR-2用“视觉因果流”让AI像人一样读懂文档
ocr
Luke Ewin9 小时前
部署DeepSeek-OCR-2
ocr·deepseek·deepseek-ocr-2
confiself9 小时前
DeepSeek-OCR 2: Visual Causal Flow学习
学习·ocr
AI周红伟9 小时前
周红伟 DeepSeek-OCR v2技术原理和架构,部署案例实操
ocr
清静诗意10 小时前
使用 Certbot 在腾讯云生成 Let’s Encrypt 通配符证书完整教程
腾讯云·ssl证书