I'm trying to download a file from Google Docs via Axios and I get this error in return:
{
"message": "Request failed with status code 404",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 404\n at settle (/Users/janswist/Developer/pdf-generator/functions/node_modules/axios/dist/node/axios.cjs:1261:12)\n at Unzip.handleStreamEnd (/Users/janswist/Developer/pdf-generator/functions/node_modules/axios/dist/node/axios.cjs:2439:11)\n at Unzip.emit (node:events:402:35)\n at endReadableNT (node:internal/streams/readable:1343:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {
"Blob": null
},
"headers": {
"Accept": "application/json, text/plain, */*",
"User-Agent": "axios/1.0.0",
"Accept-Encoding": "gzip, deflate, br"
},
"method": "get",
"url": "https://docs.google.com/document/d/15lhnj6sp1QFb9k-GmRCe8RVbwfbNM3es-xCt9mIu5Qc/export?format=docx",
"responseType": "arraybuffer"
},
"code": "ERR_BAD_REQUEST",
"status": 404
}
File exists and is shared, when you use the link directly it begins the download so I'm not sure how to even tackle it.
edit: My Axios code - pretty simple:
const { data } = await axios({
method: 'get',
url,
responseType: 'arraybuffer'
})