融茂软件
融茂软件
  • 发布:2025-11-06 15:25
  • 更新:2025-11-06 15:44
  • 阅读:39

【报Bug】底层request编译accept头错误,导致整体所有请求报错

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 26

第三方开发者工具版本号: 最新的

基础库版本号: 3.0.0-4070620250821001

项目创建方式: CLI

CLI版本号: 最新的

示例代码:
# This is a workflow for Continuous Integration (CI) for a VitePress project  
name: 构建并上传到微信小程序-上传正式服  

# Controls when the workflow will run  
on:  
  # git tag uniapp-mp-1.0 && git push origin --tags  
  push:  
    branches:  
      - main  

  # Allows you to run this workflow manually from the Actions tab  
  workflow_dispatch:  

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages  
permissions:  
  contents: read  
  id-token: write  

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.  
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.  
concurrency:  
  group: "pages"  
  cancel-in-progress: false  

# A workflow run consists of one or more jobs  
jobs:  
  build:  
    # The type of runner that the job will run on  
    runs-on: ubuntu-latest  
    permissions:  
      contents: read  # 只读权限  
      actions: write   # 写操作权限  

    # 在作业级别设置环境变量  
    # env:  
    #   NODE_ENV: production  
    #   CI: true  

    # Steps represent a sequence of tasks that will be executed as part of the job  
    steps:  
      # Checks out your repository under $GITHUB_WORKSPACE, allowing access to the codebase  
      - name: 检查环境  
        uses: actions/checkout@v4  

      # Set up Node.js environment  
      - name: 安装Nodejs  
        uses: actions/setup-node@v4  
        with:  
          node-version: '20'  # Specify the Node.js version to use  
      #          cache: ${{ steps.detect-package-manager.outputs.manager }}  

      # 安装 pnpm  
      - name: 安装 pnpm  
        uses: pnpm/action-setup@v2  
        with:  
            version: 8  
            run_install: false  

      # Install project dependencies using pnpm  
      - name: 安装依赖  
        working-directory: uniapp  
        run: pnpm i  

      # Build the WeChat Mini Program  
      - name: 构建微信小程序  
        working-directory: uniapp  
        run: pnpm run build:mp-weixin  
        env:  
          NODE_ENV: production  
          CI: true  

      - name: 生成版本号  
        id: version  
        run: |  
          VERSION=$(date +%y-%m-%d)  
          echo "version=$VERSION" >> $GITHUB_OUTPUT  
          echo "Generated version: $VERSION"  

      - name: 上传到微信小程序  
        uses: seepine/action-miniprogram-ci@v1  
        with:  
          project-path: uniapp/dist/build/mp-weixin  
          private-key: ${{ secrets.WECHAT_MINI_UPLOAD_KEY }}  
          version: ${{ steps.version.outputs.version }}  
          desc: "prod"  
          robot: 12
{  
    "name": "uni-preset-vue",  
    "version": "0.0.0",  
    "scripts": {  
        "postinstall": "weapp-tw patch",  
        "dev:app": "uni -p app",  
        "dev:app-android": "uni -p app-android",  
        "dev:app-ios": "uni -p app-ios",  
        "dev:app-harmony": "uni -p app-harmony",  
        "dev:custom": "uni -p",  
        "dev:h5": "uni",  
        "dev:h5:ssr": "uni --ssr",  
        "dev:mp-alipay": "uni -p mp-alipay",  
        "dev:mp-baidu": "uni -p mp-baidu",  
        "dev:mp-jd": "uni -p mp-jd",  
        "dev:mp-kuaishou": "uni -p mp-kuaishou",  
        "dev:mp-lark": "uni -p mp-lark",  
        "dev:mp-qq": "uni -p mp-qq",  
        "dev:mp-toutiao": "uni -p mp-toutiao",  
        "dev:mp-weixin": "uni -p mp-weixin",  
        "dev:mp-xhs": "uni -p mp-xhs",  
        "dev:quickapp-webview": "uni -p quickapp-webview",  
        "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",  
        "dev:quickapp-webview-union": "uni -p quickapp-webview-union",  
        "build:app": " uni build -p app",  
        "build:app-android": " uni build -p app-android",  
        "build:app-ios": " uni build -p app-ios",  
        "build:app-harmony": " uni build -p app-harmony",  
        "build:custom": " uni build -p",  
        "build:h5": " uni build",  
        "build:h5:ssr": " uni build --ssr",  
        "build:mp-alipay": " uni build -p mp-alipay",  
        "build:mp-baidu": " uni build -p mp-baidu",  
        "build:mp-jd": " uni build -p mp-jd",  
        "build:mp-kuaishou": " uni build -p mp-kuaishou",  
        "build:mp-lark": " uni build -p mp-lark",  
        "build:mp-qq": " uni build -p mp-qq",  
        "build:mp-toutiao": " uni build -p mp-toutiao",  
        "build:mp-weixin": " uni build -p mp-weixin",  
        "build:mp-xhs": " uni build -p mp-xhs",  
        "build:quickapp-webview": " uni build -p quickapp-webview",  
        "build:quickapp-webview-huawei": " uni build -p quickapp-webview-huawei",  
        "build:quickapp-webview-union": " uni build -p quickapp-webview-union",  
        "type-check": "vue-tsc --noEmit",  
        "format": "prettier --write src/"  
    },  
    "dependencies": {  
        "@dcloudio/uni-app": "3.0.0-4070620250821001",  
        "@dcloudio/uni-app-harmony": "3.0.0-4070620250821001",  
        "@dcloudio/uni-app-plus": "3.0.0-4070620250821001",  
        "@dcloudio/uni-components": "3.0.0-4070620250821001",  
        "@dcloudio/uni-h5": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-alipay": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-baidu": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-harmony": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-jd": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-kuaishou": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-lark": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-qq": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-toutiao": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-weixin": "3.0.0-4070620250821001",  
        "@dcloudio/uni-mp-xhs": "3.0.0-4070620250821001",  
        "@dcloudio/uni-quickapp-webview": "3.0.0-4070620250821001",  
        "@dcloudio/uni-ui": "^1.5.11",  
        "@weapp-tailwindcss/merge": "^1.2.3",  
        "dayjs": "^1.11.13",  
        "lodash-es": "^4.17.21",  
        "pinia": "^2.2.4",  
        "pinia-plugin-unistorage": "^0.1.2",  
        "prettier-plugin-organize-imports": "^4.2.0",  
        "prettier-plugin-tailwindcss": "^0.6.14",  
        "vconsole": "^3.15.1",  
        "vue": "^3.5.16",  
        "vue-i18n": "^9.14.2",  
        "weixin-js-sdk": "^1.6.5"  
    },  
    "devDependencies": {  
        "@dcloudio/types": "^3.4.14",  
        "@dcloudio/uni-automator": "3.0.0-4070620250821001",  
        "@dcloudio/uni-cli-shared": "3.0.0-4070620250821001",  
        "@dcloudio/uni-stacktracey": "3.0.0-4070620250821001",  
        "@dcloudio/vite-plugin-uni": "3.0.0-4070620250821001",  
        "@tailwindcss/postcss": "^4.1.13",  
        "@types/lodash-es": "^4.17.12",  
        "@types/node": "^22.7.4",  
        "@vue/runtime-core": "^3.5.21",  
        "@vue/tsconfig": "^0.8.1",  
        "autoprefixer": "^10.4.21",  
        "concurrently": "^9.2.1",  
        "postcss": "^8.5.3",  
        "prettier": "^3.0.0",  
        "sass": "^1.92.1",  
        "sass-loader": "10.1.1",  
        "tailwindcss": "^4.1.13",  
        "typescript": "^4.9.4",  
        "vite": "5.2.8",  
        "vue-tsc": "^2.2.10",  
        "weapp-ide-cli": "^3.1.0",  
        "weapp-tailwindcss": "^4.3.0"  
    }  
}

操作步骤:

编译即可,查看编译后的文推荐

预期结果:

application/json 错误编译为 application/json

实际结果:

application/json 错误编译为 application_fjson

bug描述:

在如下的版本号,使用github action构建,和本地npm 构建均出现将 application/json 错误编译为 application_fjson 的错误,导致服务端因为接受 Accept 头解析,所有请求全部报错

2025-11-06 15:25 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

hello,可以试一下微信原生上是否也存在这个问题

  • 融茂软件 (作者)

    这个是编译过程出错,是编译到微信原生的过程

    微信手敲不存在这个问题

    2025-11-06 15:38

DCloud_UNI_yuhe

DCloud_UNI_yuhe

我这到没这个情况,你提供一下测试项目看看

  • 融茂软件 (作者)

    项目的package.json和自动化脚本,还有本地的pnpm npm版本都贴出来了,你替换一下就行

    2025-11-06 15:52

  • 融茂软件 (作者)

    你们协助核定bug有什么激励政策,没的话你们自己查吧,今天刚出的这个问题;有的话可以视情况协助;包括下面那个content-type也是一样,取消注释也会变成 application_fjson,而不是正确的application/json

    2025-11-06 15:55

  • DCloud_UNI_yuhe

    回复 融茂软件: 没有激励政策,如果您想要得到协助,也方便我们处理问题,请您提供一下一个最简的可以复现的测试项目

    2025-11-06 16:08

  • 融茂软件 (作者)

    回复 DCloud_UNI_yuhe: 我不需要协助,注释了就好了;不手动指定就是对的

    2025-11-06 16:27

要回复问题请先登录注册