确定下容器内启动的服务监听端口和配置端口对不对得上。
同样配置之前可以,现在一直提示connection refused,怎么解决?[图片]
12-12url处理&的问题,&times 在 url 中就表现为了 x https://www.cnblogs.com/gyfluck/p/12558079.html
node.js 把json对象 生成URL查询字符串出错?raw = function (args) { var keys = Object.keys(args); keys = keys.sort() var newArgs = {}; keys.forEach(function (key) { newArgs[key] = args[key]; }); var rawstr1 = Object.keys(newArgs) .map(key => `${key}=${typeof newArgs[key]=='object'?JSON.stringify(newArgs[key]):newArgs[key]}`) .join('&'); return rawstr1; }; raw({sign_type:'RSA2',timestamp:'2024-12-08 01:15:22'}) 线下,json对象正常,线上sign_type=RSA2×tamp=2024-12-08 01:15:22 生成 sign_type=RSA2×tamp=2024-12-08 01:15:22 × 变成 x 线下本机正常返回 run 03 /api/cardbusiness/aggregatepay/b2c/online/consumepurchase/V1?app_id=11000000000000030694&biz_content={"mer_id":"200207010683","mer_prtcl_no":"200207010683","pay_mode":"9","access_type":"9","out_trade_no":"6624120700142","decive_info":"6601","body":"御温泉-线上支付662412070014","fee_type":"001","icbc_appid":"11000000000000030694","mer_url":"https://ywqapp-44422-8-1317875567.sh.run.tcloudbase.com/cloud/postapi/gbankpayok/","orig_date_time":"2024-12-07T23:35:22","spbill_create_ip":"11.163.0.81","total_fee":"11900","notify_type":"HS","open_id":"oLHtI5I8uLo9Lcly9XdBYnUeFRaw","shop_appid":"wxc44eb4841c41970c"}&charset=UTF-8&format=json&msg_id=662412070014-001-g2whol2&sign_type=RSA2×tamp=2024-12-08 01:15:22
12-121、 需要初始化环境 2、x-wx-service需要配置上对应需要调用的服务名
wx.request的错误回调fail问题?使用云托管wx.cloud.callContainer,文档说和wx.request用法一致 try{ const result = await wx.cloud.callContainer({ "config": {"env": ""}, "path": path, "header": { "X-WX-SERVICE": "", "content-type": "application/json" }, "method": method, "data": data, }); console.log(`微信云托管调用结果${result.errMsg} | callid:${result.callID}`) console.log(result) }catch(e){ //只要请求的接口返回状态码不是2xx都会进入fail const error = e.toString() console.log(error) throw new Error(`微信云托管调用失败${error}`) } 请求服务端接口时发现只要不是2xx的状态码都会进入fail,只有errno errmsg。 并没有像文档说的不管服务端接口返回什么状态码都会success。这是什么问题呢 [图片]
12-12可以安装模板后下载模板对应的代码包查看,或查看下面这个项目内的dockerfile https://github.com/WeixinCloud/wxcloudrun-thinkphp-nginx
微信云托管的模版中thinkphp是那个版本的?https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloudrun/src/quickstart/template/official.htmlhttps://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloudrun/src/quickstart/template/ 微信云托管的模版中thinkphp是那个版本的?
12-12可以查看dockerhub中官方nodejs的镜像版本 https://hub.docker.com/_/node
微信云托管中FROM node:12-slim这里node最高版本可选哪个?在项目目录中,新建 [代码]Dockerfile[代码] 文件,并在文件中填入如下信息FROM node:12-slim WORKDIR /usr/src/app COPY package*.json ./ RUN npm install --only=production COPY . ./ CMD [ "node", "index.js" ] 本地电脑是node.js v20.18.0调试正常,云托管 node:12-slim 发现一些错误 ,怎么设置FROM node:12-slim这里的node版本
12-12测试域名建议只用于开发测试,不要用于正式业务。正式业务请绑定自定义域名。
云托管只能通过域名访问吗?需求是发送模板消息,部署到环境上,目前是通过测试域名测试没问题,想问下这个测试域名有时间限制吗? 还有就是可不可以通过ip端口的形式进行访问??如果可以的话需要怎么操作??
12-021、callContainer不是标准http接口,会有不同。 2、callContainer接口有请求大小限制,不建议用于文件上传
微信云托管服务接收不到formdata中的files?因为我在使用web访问云托管,但是云托管部署的服务的接口,接收不到我发送的formdata中的file文件 #这部分是接口 static addImageBanner(imageName: File) { const formData = new FormData(); formData.append('file', imageName); return callCloud(`${ROOM_BASE_URL}/Add_ImgBanner`, { method: "post", headers: { // 'Content-Type': 'application/octet-stream', "Content-Type": "multipart/form-data", "X-File-Name": imageName.name, }, data: formData, }); } 这个是callCloud的封装 export async function callCloud(path: string, options: any) { // 打印携带的数据 // console.log('携带的数据:', dataa); const c1 = new cloud.Cloud({ identityless: true, resourceAppid: "******", resourceEnv: "********", }); if (options.data && typeof options.data.entries === 'function') { for (let [key, value] of options.data.entries()) { console.log(key, value); } } else { console.log("options.data is undefined or does not have entries method"); } await c1.init(); let fullUrl = `${path}`; console.log(fullUrl); // 处理查询参数 if (options.params && Object.keys(options.params).length > 0) { const queryString = Object.entries(options.params) .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value as string)}`) .join('&'); fullUrl += `?${queryString}`; } const callContainerPromise = c1.callContainer({ path: fullUrl, method: options.method || "GET", header: { "X-WX-SERVICE": "ypyz", // xxx中填入服务名称(微信云托管 - 服务管理 - 服务列表 - 服务名称) ...options.headers, }, data: options.data || {}, }); const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error("请求超时")), 15000) ); try { const result = await Promise.race([callContainerPromise, timeoutPromise]); console.log(`微信云托管调用结果${result.errMsg} | callid:${result.callID}`); console.log(result); return result.data; } catch (error) { console.error("Error in callCloud:", error); throw error; } } 这个是后端代码 def post(self): rp = RequestParser() rp.add_argument('file', action='append', required=True, location='files', type=FileStorage) args = rp.parse_args() files = args.get('file') try: # files = request.data if not files: current_app.logger.error('没有上传文件') return {'code': 400, 'msg': '请上传图片'} else: img_list = ImgBanner.query.order_by(ImgBanner.created_at.asc()) current_app.logger.info(f"数据库中图片数量: {img_list.count()}") # FileUpload # 获取文件名 # for uploaded_file in files: base_dir = Path(__file__).resolve().parent.parent.parent if not os.path.exists(os.path.join(base_dir / 'static/roomimage')): try: os.makedirs(os.path.join(base_dir / 'static/roomimage')) current_app.logger.info(f"当前路径{base_dir / 'static/roomimage'}") current_app.logger.info(f"Directory roomimage created successfully.") except Exception as e: current_app.logger.error(f"Failed to create directory roomimage: {e}") return {'code': 20003, 'msg': '无法创建目录'} file_name = request.headers.get('X-File-Name', 'default.jpg') # file_name = uploaded_file.filename img_name = f"{uuid.uuid4().hex}" uuid_image_name = img_name + '-' + f'{file_name}' temp_file_path = os.path.join(base_dir / 'static/roomimage', uuid_image_name) # 保存文件对象到临时文件 files[0].save(temp_file_path) # with open(temp_file_path, 'wb') as f: # f.write(files) # files.save(temp_file_path) result = FileUpload.upload_main(uuid_image_name) if result['code'] == 200: file_list = [{'fileid': result['data']['file_id'], 'max_age': 30}] image_url = FileUpload.get_download_url(file_list) url = json.dumps(image_url['data']['file_list'][0]['download_url']).replace('"', '') new_image = ImgBanner(file_id=result['data']['file_id'], image_url=url, image_name=uuid_image_name) db.session.add(new_image) try: # 需要用到数据库事务处理 db.session.commit() except Exception as e: current_app.logger.error(f"Failed to save image to database: {e}") db.session.rollback() return {'code': 20004, 'msg': '保存图片到数据库失败'} else: current_app.logger.error(f"Failed to upload file: {result['msg']}") return {'code': 20002, 'msg': '上传失败'} return {'code': 200, 'msg': '上传成功'} except Exception as e: current_app.logger.error(f'处理上传文件时出错: {e}') return {'code': 500, 'msg': '服务器内部错误'} 但是我选择图片上传后报错 [图片] 就是在云托管服务上拿不到formdata中的file字段文件,但是在本地测试的时候可以拿到,没有问题,有没有大佬给解决一下啊
12-02定义好后端服务侧用什么时区,并按固定时区写入数据和读出数据进行处理即可。
云托管的容器和mysql时区不一致怎么办?云托管的容器是0时区的,但是分配的mysql是+8的北京时间,我使用SET GLOBAL time_zone = '+00:00' 修改mysql的时区显示我的root帐户也没有权限,我想将mysql的时区也调整为0时区有办法吗
12-02除了部署日志外,可以看看有没有服务日志打印。 Back-off restarting failed container 这个错误是容器启动不起来,需要排查是否是引入的包导致的进程启动失败
云托管部署报错是什么原因?只要写上const OpenAI = require('openai');就会报错 package.json也已经写了依赖 这是index.js完整代码 const Koa = require("koa"); const Router = require("koa-router"); const logger = require("koa-logger"); const bodyParser = require("koa-bodyparser"); const fs = require("fs"); const path = require("path"); const axios = require('axios'); const cors = require('koa2-cors'); const { PassThrough } = require('stream'); const OpenAI = require('openai'); const { init: initDB, Counter } = require("./db"); const router = new Router(); const homePage = fs.readFileSync(path.join(__dirname, "index.html"), "utf-8"); const openai = new OpenAI({ apiKey: '', baseURL: 'https://ark.cn-beijing.volces.com/api/v3', }); router.get("/api/douyin", async (ctx) => { ctx.set('Content-Type', 'text/event-stream'); ctx.set('Cache-Control', 'no-cache'); ctx.set('Connection', 'keep-alive'); const stream = new PassThrough(); ctx.body = stream; // 获取前端传递的用户输入 const userMessage = ctx.query.message || '默认用户消息'; // Streaming: console.log('----- streaming request -----'); const aiStream = await openai.chat.completions.create({ messages: JSON.parse(userMessage), model: 'ep-20241120160801-7tnrg', stream: true, }); for await (const part of aiStream) { console.log(part.choices[0]); stream.write(`data: ${JSON.stringify(part)}\n\n`); } }) docketile文件代码 # 二开推荐阅读[如何提高项目构建效率](https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/scene/build/speed.html) FROM alpine:3.13 # 容器默认时区为UTC,如需使用上海时间请启用以下时区设置命令 # RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone # 使用 HTTPS 协议访问容器云调用证书安装 RUN apk add ca-certificates # 安装依赖包,如需其他依赖包,请到alpine依赖包管理(https://pkgs.alpinelinux.org/packages?name=php8*imagick*&branch=v3.13)查找。 RUN apk add --update --no-cache nodejs npm # # 指定工作目录 WORKDIR /app # 拷贝包管理文件 COPY package*.json /app # npm 源,选用国内镜像源以提高下载速度 RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ # RUN npm config set registry https://registry.npm.taobao.org/ # npm 安装依赖 RUN npm install # 将当前目录(dockerfile所在目录)下所有文件都拷贝到工作目录下(.gitignore中的文件除外) COPY . /app # 执行启动命令. # 写多行独立的CMD命令是错误写法!只有最后一行CMD命令会被执行,之前的都会被忽略,导致业务报错。 # 请参考[Docker官方文档之CMD命令](https://docs.docker.com/engine/reference/builder/#cmd) CMD ["npm", "start"] [2024-11-22 12:20:39] Started by user coding [2024-11-22 12:20:39] Running in Durability level: MAX_SURVIVABILITY [2024-11-22 12:20:41] [Pipeline] Start of Pipeline [2024-11-22 12:20:41] [Pipeline] node [2024-11-22 12:20:41] Running on Jenkins in /root/workspace [2024-11-22 12:20:41] [Pipeline] { [2024-11-22 12:20:41] [Pipeline] stage [2024-11-22 12:20:41] [Pipeline] { (检出软件包) [2024-11-22 12:20:41] Stage "检出软件包" skipped due to when conditional [2024-11-22 12:20:41] [Pipeline] } [2024-11-22 12:20:41] [Pipeline] // stage [2024-11-22 12:20:41] [Pipeline] stage [2024-11-22 12:20:41] [Pipeline] { (检出 ZIP 包) [2024-11-22 12:20:41] Stage "检出 ZIP 包" skipped due to when conditional [2024-11-22 12:20:41] [Pipeline] } [2024-11-22 12:20:41] [Pipeline] // stage [2024-11-22 12:20:41] [Pipeline] stage [2024-11-22 12:20:41] [Pipeline] { (检出代码仓库) [2024-11-22 12:20:42] [Pipeline] sh [2024-11-22 12:20:42] + git clone ****** . [2024-11-22 12:20:42] Cloning into '.'... [2024-11-22 12:20:50] [Pipeline] sh [2024-11-22 12:20:50] + git checkout master [2024-11-22 12:20:50] Already on 'master' [2024-11-22 12:20:50] Your branch is up to date with 'origin/master'. [2024-11-22 12:20:50] [Pipeline] } [2024-11-22 12:20:50] [Pipeline] // stage [2024-11-22 12:20:50] [Pipeline] stage [2024-11-22 12:20:50] [Pipeline] { (写入 dockerfile) [2024-11-22 12:20:50] Stage "写入 dockerfile" skipped due to when conditional [2024-11-22 12:20:50] [Pipeline] } [2024-11-22 12:20:50] [Pipeline] // stage [2024-11-22 12:20:50] [Pipeline] stage [2024-11-22 12:20:50] [Pipeline] { (构建 Docker 镜像) [2024-11-22 12:20:50] [Pipeline] sh [2024-11-22 12:20:51] + docker login -u ****** -p ****** ccr.ccs.tencentyun.com/tcb-******-cclm/ca-goytyvue_koa-oass:koa-oass-024-20241122122036 [2024-11-22 12:20:51] WARNING! Using --password via the CLI is insecure. Use --password-stdin. [2024-11-22 12:20:51] WARNING! Your password will be stored unencrypted in /root/.docker/config.json. [2024-11-22 12:20:51] Configure a credential helper to remove this warning. See [2024-11-22 12:20:51] https://docs.docker.com/engine/reference/commandline/login/#credentials-store [2024-11-22 12:20:51] [2024-11-22 12:20:51] Login Succeeded [2024-11-22 12:20:51] [Pipeline] sh [2024-11-22 12:20:51] + docker build -f ././/Dockerfile -t ccr.ccs.tencentyun.com/tcb-******-cclm/ca-goytyvue_koa-oass:koa-oass-024-20241122122036 ./ [2024-11-22 12:20:52] #0 building with "default" instance using docker driver [2024-11-22 12:20:52] [2024-11-22 12:20:52] #1 [internal] load build definition from Dockerfile [2024-11-22 12:20:52] #1 transferring dockerfile: 1.40kB done [2024-11-22 12:20:52] #1 DONE 0.1s [2024-11-22 12:20:52] [2024-11-22 12:20:52] #2 [internal] load .dockerignore [2024-11-22 12:20:52] #2 transferring context: 2B done [2024-11-22 12:20:52] #2 DONE 0.1s [2024-11-22 12:20:52] [2024-11-22 12:20:52] #3 [internal] load metadata for docker.io/library/alpine:3.13 [2024-11-22 12:20:53] #3 DONE 1.1s [2024-11-22 12:20:53] [2024-11-22 12:20:53] #4 [1/8] FROM docker.io/library/alpine:3.13@sha256:469b6e04ee185740477efa44ed5bdd64a07bbdd6c7e5f5d169e540889597b911 [2024-11-22 12:20:53] #4 resolve docker.io/library/alpine:3.13@sha256:469b6e04ee185740477efa44ed5bdd64a07bbdd6c7e5f5d169e540889597b911 0.1s done [2024-11-22 12:20:53] #4 sha256:469b6e04ee185740477efa44ed5bdd64a07bbdd6c7e5f5d169e540889597b911 1.64kB / 1.64kB done [2024-11-22 12:20:53] #4 sha256:16fd981ddc557fd3b38209d15e7ee8e3e6d9d4d579655e8e47243e2c8525b503 528B / 528B done [2024-11-22 12:20:53] #4 sha256:6b5c5e00213a401b500630fd8a03f6964f033ef0e3a6845c83e780fcd5deda5c 1.47kB / 1.47kB done [2024-11-22 12:20:53] #4 sha256:72cfd02ff4d01b1f319eed108b53120dea0185b916d2abeb4e6121879cbf7a65 0B / 2.83MB 0.1s [2024-11-22 12:20:54] #4 sha256:72cfd02ff4d01b1f319eed108b53120dea0185b916d2abeb4e6121879cbf7a65 2.83MB / 2.83MB 0.4s [2024-11-22 12:20:54] #4 extracting sha256:72cfd02ff4d01b1f319eed108b53120dea0185b916d2abeb4e6121879cbf7a65 0.1s done [2024-11-22 12:20:54] #4 sha256:72cfd02ff4d01b1f319eed108b53120dea0185b916d2abeb4e6121879cbf7a65 2.83MB / 2.83MB 0.4s done [2024-11-22 12:20:54] #4 DONE 0.7s [2024-11-22 12:20:54] [2024-11-22 12:20:54] #5 [internal] load build context [2024-11-22 12:20:54] #5 transferring context: 73.02MB 0.8s done [2024-11-22 12:20:54] #5 DONE 0.9s [2024-11-22 12:20:54] [2024-11-22 12:20:54] #6 [2/8] RUN apk add ca-certificates [2024-11-22 12:20:54] #6 0.214 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz [2024-11-22 12:20:54] #6 0.747 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz [2024-11-22 12:20:55] #6 1.223 (1/1) Installing ca-certificates (20220614-r0) [2024-11-22 12:20:55] #6 1.269 Executing busybox-1.32.1-r9.trigger [2024-11-22 12:20:55] #6 1.272 Executing ca-certificates-20220614-r0.trigger [2024-11-22 12:20:55] #6 1.301 OK: 6 MiB in 15 packages [2024-11-22 12:20:55] #6 DONE 1.6s [2024-11-22 12:20:55] [2024-11-22 12:20:55] #7 [3/8] RUN apk add --update --no-cache nodejs npm [2024-11-22 12:20:56] #7 0.317 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz [2024-11-22 12:20:56] #7 0.585 fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz [2024-11-22 12:20:56] #7 0.769 (1/7) Installing nghttp2-libs (1.42.0-r1) [2024-11-22 12:20:56] #7 0.802 (2/7) Installing brotli-libs (1.0.9-r3) [2024-11-22 12:20:56] #7 0.840 (3/7) Installing c-ares (1.17.2-r0) [2024-11-22 12:20:56] #7 0.872 (4/7) Installing libgcc (10.2.1_pre1-r3) [2024-11-22 12:20:56] #7 0.905 (5/7) Installing libstdc++ (10.2.1_pre1-r3) [2024-11-22 12:20:56] #7 0.946 (6/7) Installing nodejs (14.20.1-r0) [2024-11-22 12:20:57] #7 1.392 (7/7) Installing npm (14.20.1-r0) [2024-11-22 12:20:57] #7 1.703 Executing busybox-1.32.1-r9.trigger [2024-11-22 12:20:57] #7 1.708 OK: 71 MiB in 22 packages [2024-11-22 12:20:57] #7 DONE 1.8s [2024-11-22 12:20:57] [2024-11-22 12:20:57] #8 [4/8] WORKDIR /app [2024-11-22 12:20:57] #8 DONE 0.2s [2024-11-22 12:20:57] [2024-11-22 12:20:57] #9 [5/8] COPY package*.json /app [2024-11-22 12:20:57] #9 DONE 0.1s [2024-11-22 12:20:57] [2024-11-22 12:20:57] #10 [6/8] RUN npm config set registry https://mirrors.cloud.tencent.com/npm/ [2024-11-22 12:20:58] #10 DONE 0.4s [2024-11-22 12:20:58] [2024-11-22 12:20:58] #11 [7/8] RUN npm install [2024-11-22 12:20:58] #11 0.751 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I'll try to do my best with it! [2024-11-22 12:20:59] #11 1.292 npm WARN deprecated koa-router@10.1.1: **IMPORTANT 10x+ PERFORMANCE UPGRADE**: Please upgrade to v12.0.1+ as we have fixed an issue with debuglog causing 10x slower router benchmark performance, see https://github.com/koajs/router/pull/173 [2024-11-22 12:21:04] #11 6.543 npm WARN wxcloudrun-koa@1.0.0 No repository field. [2024-11-22 12:21:04] #11 6.544 [2024-11-22 12:21:04] #11 6.545 added 147 packages from 200 contributors and audited 147 packages in 5.825s [2024-11-22 12:21:04] #11 6.595 [2024-11-22 12:21:04] #11 6.595 17 packages are looking for funding [2024-11-22 12:21:04] #11 6.595 run `npm fund` for details [2024-11-22 12:21:04] #11 6.595 [2024-11-22 12:21:04] #11 6.596 found 5 vulnerabilities (2 moderate, 1 high, 2 critical) [2024-11-22 12:21:04] #11 6.596 run `npm audit fix` to fix them, or `npm audit` for details [2024-11-22 12:21:04] #11 DONE 6.8s [2024-11-22 12:21:04] [2024-11-22 12:21:04] #12 [8/8] COPY . /app [2024-11-22 12:21:05] #12 DONE 0.6s [2024-11-22 12:21:05] [2024-11-22 12:21:05] #13 exporting to image [2024-11-22 12:21:05] #13 exporting layers [2024-11-22 12:21:06] #13 exporting layers 0.7s done [2024-11-22 12:21:06] #13 writing image sha256:4a5ebe5d9f58db3a45f45a4b3a4842c65a7b04477ae1dbd2d2d2d9a48855e3f4 done [2024-11-22 12:21:06] #13 naming to ccr.ccs.tencentyun.com/tcb-******-cclm/ca-goytyvue_koa-oass:koa-oass-024-20241122122036 done [2024-11-22 12:21:06] #13 DONE 0.7s [2024-11-22 12:21:06] [Pipeline] } [2024-11-22 12:21:06] [Pipeline] // stage [2024-11-22 12:21:06] [Pipeline] stage [2024-11-22 12:21:06] [Pipeline] { (推送 Docker 镜像到 TCR) [2024-11-22 12:21:06] [Pipeline] sh [2024-11-22 12:21:06] + docker push ccr.ccs.tencentyun.com/tcb-******-cclm/ca-goytyvue_koa-oass:koa-oass-024-20241122122036 [2024-11-22 12:21:06] The push refers to repository [ccr.ccs.tencentyun.com/tcb-******-cclm/ca-goytyvue_koa-oass] [2024-11-22 12:21:06] 63a6ea71939b: Preparing [2024-11-22 12:21:06] 3939b7e44f93: Preparing [2024-11-22 12:21:06] d43a2a7c1b91: Preparing [2024-11-22 12:21:06] 0dc12778368a: Preparing [2024-11-22 12:21:06] 058689fe2b3d: Preparing [2024-11-22 12:21:06] 54a29fc9b264: Preparing [2024-11-22 12:21:06] 79aadad60446: Preparing [2024-11-22 12:21:06] 7df5bd7bd262: Preparing [2024-11-22 12:21:06] 7df5bd7bd262: Layer already exists [2024-11-22 12:21:07] 058689fe2b3d: Pushed [2024-11-22 12:21:07] d43a2a7c1b91: Pushed [2024-11-22 12:21:07] 0dc12778368a: Pushed [2024-11-22 12:21:09] 79aadad60446: Pushed [2024-11-22 12:21:15] 3939b7e44f93: Pushed [2024-11-22 12:21:16] 54a29fc9b264: Pushed [2024-11-22 12:21:20] 63a6ea71939b: Pushed [2024-11-22 12:21:21] koa-oass-024-20241122122036: digest: sha256:8e8262ed07e730c2ad5ec19c7843d40dcef6b8f0abc54510394fa895c7d87ae4 size: 1998 [2024-11-22 12:21:22] [Pipeline] } [2024-11-22 12:21:22] [Pipeline] // stage [2024-11-22 12:21:22] [Pipeline] } [2024-11-22 12:21:22] [Pipeline] // node [2024-11-22 12:21:22] [Pipeline] End of Pipeline [2024-11-22 12:21:22] Finished: SUCCESS *** -----------构建koa-oass-024----------- 2024-11-22 12:20:38 create_build_image : succ, 2024-11-22 12:21:26 check_build_image : succ, , -----------服务koa-oass部署koa-oass-024----------- 2024-11-22 12:21:27 create_eks_virtual_service : succ, 2024-11-22 12:21:27 check_eks_virtual_service : process, DescribeVersion_user_error_Back-off restarting failed container, [service]:[Back-off restarting failed container,]
11-27https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/resource-sharing/ 可以根据此文档进行环境初始化 // 声明新的 cloud 实例 var c1 = new wx.cloud.Cloud({ // 资源方 AppID resourceAppid: 'wxxxxxxxxxxxxx', // 资源方环境 ID resourceEnv: 'test-xxxxxx', }) // 跨账号调用,必须等待 init 完成 // init 过程中,资源方小程序对应环境下的 cloudbase_auth 函数会被调用,并需返回协议字段(见下)来确认允许访问、并可自定义安全规则 await c1.init() // 完成后正常使用资源方的已授权的云资源 await c1.callFunction({ name: '函数名', data: {}, })
微信开发者工具教育版,如何将图片等文件上传到腾讯云存储?已经初始化了云环境,数据库可以写入数据,但是调用uploadFile方法会报错 let c1 =new wx.cloud.Cloud({ resourceAppid: "wx3199c80279c7b8c3", resourceEnv: "education-0g8u3z15a7381e80", }); c1.init({ env:"education-0g8u3z15a7381e80", traceUser:true }); Page({ data:{ filePath:"" }, clickBtn(){ wx.chooseMedia({ count: 1, mediaType: ['image'], sourceType: ['album', 'camera'], camera: 'back', success:(res) =>{ this.setData({ filePath:res.tempFiles[0].tempFilePath }) console.log(this.data.filePath) //console.log(res.tempFiles[0].size) } }) }, add(){ c1.database().collection("demolist").add({ data:{ filePath:this.data.filePath, }, }).then((res)=>{ console.log("success2") }) .catch((err) => { console.error("写入失败:", err) }) }, upload(){ wx.cloud.uploadFile({ cloudPath:"", filePath:this.data.filePath }) .then((res)=>{ console.log(res.fileID) }) } }) 以上是js代码,可以选择图片文件,将图片文件生成临时链接添加进入数据库,但是无法上传图片到云存储 [图片]
11-26