Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Ignore 504 errors on sentry (#27745)

Joshen Lim912388913956
diff --git a/apps/studio/lib/helpers.ts b/apps/studio/lib/helpers.ts
index b84febda2d2..0ddbbc639ed 100644
--- a/apps/studio/lib/helpers.ts
+++ b/apps/studio/lib/helpers.ts
@@ -1,3 +1,5 @@
+import toast from 'react-hot-toast'
+
export { default as passwordStrength } from './password-strength'
export { default as uuidv4 } from './uuid'
@@ -140,20 +142,23 @@ export const snakeToCamel = (str: string) =>
* text content async before coping, please use Promise<string> for the 1st arg.
*/
export const copyToClipboard = async (str: string | Promise<string>, callback = () => {}) => {
- const focused = window.document.hasFocus()
- if (focused) {
- if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
- const text = await Promise.resolve(str)
- Promise.resolve(window.navigator?.clipboard?.writeText(text)).then(callback)
+ try {
+ const focused = window.document.hasFocus()
+ if (focused) {
+ if (navigator.clipboard && typeof navigator.clipboard.writeText === 'function') {
+ const text = await Promise.resolve(str)
+ Promise.resolve(window.navigator?.clipboard?.writeText(text)).then(callback)
+ return
+ }
- return
+ Promise.resolve(str)
+ .then((text) => window.navigator?.clipboard?.writeText(text))
+ .then(callback)
+ } else {
+ console.warn('Unable to copy to clipboard')
}
-
- Promise.resolve(str)
- .then((text) => window.navigator?.clipboard?.writeText(text))
- .then(callback)
- } else {
- console.warn('Unable to copy to clipboard')
+ } catch (error: any) {
+ toast.error(`Unable to copy to clipboard: ${error.message}`)
}
}
diff --git a/apps/studio/sentry.client.config.ts b/apps/studio/sentry.client.config.ts
index 331dee293b4..dd1ec4046d3 100644
--- a/apps/studio/sentry.client.config.ts
+++ b/apps/studio/sentry.client.config.ts
@@ -63,6 +63,14 @@ Sentry.init({
// Error thrown by `sql-formatter` lexer when given invalid input
// Original format: new Error(`Parse error: Unexpected "${text}" at line ${line} column ${col}`)
/^Parse error: Unexpected ".+" at line \d+ column \d+$/,
+ // [Joshen] IMO, should be caught on API if there's anything to handle - FE shouldn't dupe this alert
+ /504 Gateway Time-out/,
+ // [Joshen] This is the one caused by Google translate in the browser + 3rd party extensions
+ 'Node.insertBefore: Child to insert before is not a child of this node',
+ // [Joshen] This one sprung up recently and I've no idea where this is coming from
+ 'r.default.setDefaultLevel is not a function',
+ // [Joshen] Safe to ignore, it an error from the copyToClipboard
+ 'The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.',
],
})