关于腾讯云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);
	  }
	)
}
相关推荐
翼龙云_cloud25 分钟前
阿里云渠道商:云服务计费 按量 包年 预留实例怎么选?
服务器·阿里云·云计算
cloud studio AI应用25 分钟前
CodeBuddy 一周更新亮点丨IDE 新增 Hooks 等功能、CLI 新增Prompt 建议、SDK 自定义工具支持
腾讯云·ai编程·codebuddy
gaize12131 小时前
阿里云ECS云服务器怎么样?值得入手吗?最新测评
服务器·阿里云·云计算
博思云为2 小时前
企业级智能PPT生成:Amazon云+AI驱动,全流程自动化提效
人工智能·语言模型·云原生·数据挖掘·云计算·语音识别·aws
alvinToffler2 小时前
kkocr简单好用的ocr文字表格识别工具
ocr·文字识别·表格识别·表格按列选择
2401_865854883 小时前
腾讯云的IP是原生IP吗?
tcp/ip·云计算·腾讯云
翼龙云_cloud3 小时前
腾讯云渠道商:新手怎么在腾讯云 CVM 搭建 Ghost 博客?
运维·云计算·腾讯云
因_果_律3 小时前
AWS 自研 AI 芯片 Trainium3 全面解析
人工智能·云计算·aws
ChineHe3 小时前
Docker基础篇001_Docker入门指南(基于官方教程,5W字详细版)
运维·docker·微服务·容器·云计算·devops
亚林瓜子3 小时前
AWS API Gateway添加OAuth2请求头传递app id信息
云计算·gateway·aws·oauth2·请求头·principalid