Open britonmarketing opened 1 year ago
thanks for opening. adding my name to the list of people it's happening to
I've been experiencing this issue for a few days while collecting page data in my Next.js app. It used to occur randomly and only occasionally, but now it happens every time.
@notionhq/client warn: request fail {
code: 'notionhq_client_response_error',
message: 'Request to Notion API failed with status: 502'
}
Same for me.
same and from #172 it seems to be a really prevalent issue.
same - hadn't seen this error before but now hitting it consistently
Same. It even occurs for just reading small databases (~15 pages). It's reoccurring at an increasing amount the past week.. Error:
@notionhq/client warn: request fail {
code: 'notionhq_client_response_error',
message: 'Request to Notion API failed with status: 502'
}
My code can be found here: https://github.com/AlAgilly/yues_website/blob/main/server/index.js
Willing to give access to my databases if needed
I'm getting the same problem
Im also getting this aswell
+1. I'm experiencing this as well.
+1
+1
The main problem here is that the notion client holds on to the connection and once it hits a 502 error, every subsequent request also results in such an error. Even creating a new notion client instance doesn't solve the issue (it uses the same http agent instance).
Our current workaround:
Something along the lines:
import { Agent } from "https";
import { Client } from "@notionhq/client";
let agent, notion;
function reset() {
if (agent) agent.destroy();
agent = new Agent();
notion = new Client({ auth: process.env.NOTION_TOKEN, agent });
}
reset();
// Using the notion client:
try {
// do something with notion client
} catch(e) {
const errorText = e.toString();
if (
errorText.includes("PgPoolWaitConnectionTimeout") ||
errorText.includes("Request timed out") ||
errorText.includes("Request to Notion API has timed out") ||
errorText.includes("Request to Notion API failed with status: 502")
) {
reset();
}
}
I now also get the error
@notionhq/client warn: request fail {
code: 'service_unavailable',
message: 'Request timed out waiting to connect to a database. Please try again later.'
}
sometimes.
I just starting getting this message while trying to create a page. It was working a few days ago.
@notionhq/client warn: request fail {
code: 'notionhq_client_request_timeout',
message: 'Request to Notion API has timed out'
}
I tried the reset() solution above and didn't seem to work. What other options are there? Notion support or dev team listening in?
I am getting both these errors, almost 50% of time while GET:/ notion page, While updating a notion page, While querying a Notion database.
@notionhq/client warn: request fail {
code: 'notionhq_client_request_timeout',
message: 'Request to Notion API has timed out'
}
@notionhq/client warn: request fail {
code: 'notionhq_client_response_error',
message: 'Request to Notion API failed with status: 502'
}
Although retrying works, But It's still not viable solution and Notion API has almost become unreliable recently.
NodeJs version : 20 @notionhq/client": "^2.2.7"
Same here! Just contacted support, since i don't think they are gonna respond to this github issue. Will post update if I get a response
I'm still getting this occasionally on reads, with no discernible pattern (reads of any size, random hours...). My workaround is to simply catch the error and retry. So far I think it's always succeeded on the second try but...
It would be great if Notion either added a mention of 502s to the API docs, or silently handled the error in the SDK (make it an opt-in flag even).
Same here! Just contacted support, since i don't think they are gonna respond to this github issue. Will post update if I get a response
Just got a reply from support:
I can understand how important this is for you and the inconvenience this created to your workflow. In the last couple of days, Notion and API experienced incidents with degraded performance. I'm happy to inform you that this has now been resolved! You should be good to go! :)
In the last 24 hours I've only occasionally encountered 502s, but they are still popping up now and then. I also don't buy Notion supports claim that it has been 'an issue in the last couple of days' and that it should be resolved now. Since as far as I can tell the 502s have been happening for over two weeks.
Anyway, I believe they are still not willing to acknowledge the shabby state of their public API, and we should not except any improvements soon. My conclusion is that their API is fun for internal projects, but not production ready anytime soon.
I've implemented a workaround where the app retries fetching the API if the response is a 502, with a max of 5 retries. So far I haven't needed the fifth retry.
Same issue here, only that every requests times out or takes >20s to respond. Basically, we cannot use the API. And we haven't heard back on any of our tickets on any of the support channels about this.
I still have this problem. Can I solve it in other ways?
Would this be the correct way to catch it?
import { UnknownHTTPResponseError } from '@notionhq/client';
try {
return await notionOperation();
} catch (er) {
if (
(er instanceof UnknownHTTPResponseError && er.status === 502) ||
) {
// do retry logic
}
But I guess this should be added to the 'known' error types since seems quite common:
https://github.com/makenotion/notion-sdk-js/blob/main/src/errors.ts#L9
Still an issue in 2024.
Everything worked last week. It fails today with this error.
@notionhq/client warn: request fail {
code: "notionhq_client_response_error",
message: "Request to Notion API failed with status: 502",
}
Update: I retried the job, and I no longer get this error. It was probably resolved by Notion from the backend side.
The error is back. I have no idea what causes it.
This one is a duplicate of https://github.com/makenotion/notion-sdk-js/issues/172, it occurs for many users and needs to be re-open
I have about 30 pages, it occurs randomly on a few of them during the build