New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting 400 Bad Request in v1.2.0 with same code that returned 200 with v0.27.2 #5311
Comments
Also seeing new 400 error status codes on I'm fetching to the Notion unofficial API using a cookie: const client = axios.create({
// Notion unofficial API
baseURL: 'https://www.notion.so/api/v3',
headers: {
Cookie: `token_v2=${process.env.NOTION_TOKEN}`,
},
}); |
I'm seeing |
@jasonsaayman any idea on this one? Any way a breaking change / regression could have slipped in to |
@karlhorky See also #5314, I'm having issues as well, and I've seen a difference in responses between |
Looking at the Considering that both of the 2 reproductions above have headers... Digging in a bit to our code to check what the differences are with the request... Edit: It seems #5224 was unrelated, see below. |
Ok, it seems that the response problem fixed in #5306 (and const client = axios.create({
baseURL: 'https://www.notion.so/api/v3',
headers: { Cookie: `token_v2=${process.env.NOTION_TOKEN}` },
});
const { data: { taskId } }: { data: { taskId: string } } = await client.post('enqueueTask', {
task: {
// ...
},
});
+if (!taskId) {
+ throw new Error('No taskId returned from enqueueTask');
+}
console.log(`Started export of block ${block.dirName} as task ${taskId}`);
const { data: { results } }: { data: { results: Task[] } } = await client.post('getTasks', {
taskIds: [taskId], // 💥 taskId was undefined before, leading to "400 Bad request" errors
}); Not sure if this also affects you in the same way @jamesmortensen ... |
Can you try with the latest version and let me know if this is still an issue |
Ok, I tested The But now I have this one:
My code is like this - I'm fetching to the Notion unofficial API using a cookie: const client = axios.create({
// Notion unofficial API
baseURL: 'https://www.notion.so/api/v3',
headers: {
Cookie: `token_v2=${process.env.NOTION_TOKEN}`,
},
});
...
await client.post('enqueueTask', {
task: {
eventName: 'exportBlock',
request: {
blockId: block.id,
exportOptions: {
exportType: 'markdown',
locale: 'en',
timeZone: 'Europe/Vienna',
},
recursive: block.recursive,
},
},
}); |
Maybe I need to disable Brotli decompression or something? |
Maybe the problem that I'm getting now has to deal with downloading the data from the stream: const response = await client<Stream>({
method: 'GET',
url: block.task.status.exportURL || undefined,
responseType: 'stream',
});
const sizeInMb = Number(response.headers['content-length']) / 1000 / 1000;
console.log(`Downloading ${Math.round(sizeInMb * 1000) / 1000}mb...`);
const stream = response.data.pipe(createWriteStream(temporaryZipPath));
await new Promise((resolve, reject) => {
stream.on('close', resolve);
stream.on('error', reject);
}); |
I just updated to 1.2.1 from 1.1.3 and am getting the same end of file error:
|
Both myself and my users have been reporting Axios errors on 1.2.1. I’ll dig up some more detail shortly. Regards Jochen
```
(node:17800) UnhandledPromiseRejectionWarning: Error: unexpected end of file
at AxiosError.from (C:\Data\ZENDev\multisigapp\node_modules\axios\dist\node\axios.cjs:785:14)
at BrotliDecompress.handleStreamError (C:\Data\ZENDev\multisigapp\node_modules\axios\dist\node\axios.cjs:2696:29)
at BrotliDecompress.emit (node:events:525:35)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
```
|
I am also seeing same error with 1.2.1
|
I am getting the same error in v1.2.1 as well:
|
Wondering - maybe these |
Seems like these @jamesmortensen can you check, and if confirmed, close the issue? |
Describe the bug
We are making a get request to an endpoint that works great, returning 200 OK with v0.27.2 of axios, but when we upgrade to 1.0.0 or to the latest 1.2.0, we get 400 Bad requests.
To Reproduce
Code snippet
No response
Expected behavior
We expect the latest version to work the same as 0.27.2.
Axios Version
1.2.0
Adapter Version
UNKNOWN
Browser
N/A
Browser Version
N/A
Node.js Version
16.17.0
OS
macOS 13.0.1 M1
Additional Library Versions
Additional context/Screenshots
We are unable to include the exact payload that caused the problem since it requires authentication. We suspect/guess that maybe it is some kind of URL encoding issue that may have been introduced in v1.0.0.
The text was updated successfully, but these errors were encountered: