Wechat's official account uses koa2 to upload picture material, reporting an error of 41005.

you can pass the test by using the interface testing tools provided by Wechat"s public platform.

using koa2 to upload material is error 41005.
the code is as follows:

 let form = {
        media: fs.createReadStream(path)
    }

 return new Promise((resolve, reject) => {
        this.fetchAccessToken()
            .then(wx => {
                const ACCESS_TOKEN = wx.access_token
                const url = api_upload + "access_token="+ ACCESS_TOKEN +"&type=" + type

                axios.post(url, form)
                    .then(res => {
                  
                        let data = res.data
                        if(data) {
                            resolve(data)
                        } else {
                            console.log("")
                        }
                    }).catch(err => reject(err))
            })
    })

errors are as follows:

{ errcode: 41005,
  errmsg: "media data missing hint: [jXRSMA02471538]" }
Menu