Make Supabase postgres urls more resilient (#257)
* Bump deps * Remove redundant postgres ssl query param * Tweak postgres code * Refactor postgres url formatting * Change postgres url imports
This commit is contained in:
parent
1e55949d11
commit
eabdbf1329
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -49,6 +49,7 @@
|
|||||||
"Reala",
|
"Reala",
|
||||||
"skippable",
|
"skippable",
|
||||||
"sonner",
|
"sonner",
|
||||||
|
"sslmode",
|
||||||
"Streamable",
|
"Streamable",
|
||||||
"Supabase",
|
"Supabase",
|
||||||
"thephotoblog",
|
"thephotoblog",
|
||||||
|
|||||||
38
package.json
38
package.json
@ -10,35 +10,35 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/openai": "^1.3.22",
|
"@ai-sdk/openai": "^1.3.22",
|
||||||
"@aws-sdk/client-s3": "3.806.0",
|
"@aws-sdk/client-s3": "3.815.0",
|
||||||
"@aws-sdk/s3-request-presigner": "3.806.0",
|
"@aws-sdk/s3-request-presigner": "3.815.0",
|
||||||
"@radix-ui/react-dialog": "^1.1.13",
|
"@radix-ui/react-dialog": "^1.1.14",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.14",
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
||||||
"@radix-ui/react-tooltip": "^1.2.6",
|
"@radix-ui/react-tooltip": "^1.2.7",
|
||||||
"@radix-ui/react-visually-hidden": "^1.2.2",
|
"@radix-ui/react-visually-hidden": "^1.2.3",
|
||||||
"@upstash/ratelimit": "^2.0.5",
|
"@upstash/ratelimit": "^2.0.5",
|
||||||
"@upstash/redis": "^1.34.9",
|
"@upstash/redis": "^1.34.9",
|
||||||
"@vercel/analytics": "^1.5.0",
|
"@vercel/analytics": "^1.5.0",
|
||||||
"@vercel/blob": "^1.0.1",
|
"@vercel/blob": "^1.0.2",
|
||||||
"@vercel/speed-insights": "^1.2.0",
|
"@vercel/speed-insights": "^1.2.0",
|
||||||
"ai": "^4.3.15",
|
"ai": "^4.3.16",
|
||||||
"camelcase-keys": "^9.1.3",
|
"camelcase-keys": "^9.1.3",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^1.1.1",
|
"cmdk": "^1.1.1",
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"date-fns-tz": "^3.2.0",
|
"date-fns-tz": "^3.2.0",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"framer-motion": "^12.10.5",
|
"framer-motion": "^12.12.1",
|
||||||
"nanoid": "^5.1.5",
|
"nanoid": "^5.1.5",
|
||||||
"next": "15.3.2",
|
"next": "15.3.2",
|
||||||
"next-auth": "5.0.0-beta.27",
|
"next-auth": "5.0.0-beta.27",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"pg": "^8.15.6",
|
"pg": "^8.16.0",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"sanitize-html": "^2.16.0",
|
"sanitize-html": "^2.17.0",
|
||||||
"sharp": "^0.34.1",
|
"sharp": "^0.34.2",
|
||||||
"sonner": "^2.0.3",
|
"sonner": "^2.0.3",
|
||||||
"swr": "^2.3.3",
|
"swr": "^2.3.3",
|
||||||
"ts-exif-parser": "^0.2.2",
|
"ts-exif-parser": "^0.2.2",
|
||||||
@ -51,24 +51,24 @@
|
|||||||
"@next/eslint-plugin-next": "^15.3.2",
|
"@next/eslint-plugin-next": "^15.3.2",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tailwindcss/forms": "^0.5.10",
|
"@tailwindcss/forms": "^0.5.10",
|
||||||
"@tailwindcss/postcss": "^4.1.6",
|
"@tailwindcss/postcss": "^4.1.7",
|
||||||
"@testing-library/dom": "^10.4.0",
|
"@testing-library/dom": "^10.4.0",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^22.15.17",
|
"@types/node": "^22.15.21",
|
||||||
"@types/pg": "^8.15.1",
|
"@types/pg": "^8.15.2",
|
||||||
"@types/react": "19.1.3",
|
"@types/react": "19.1.5",
|
||||||
"@types/react-dom": "19.1.3",
|
"@types/react-dom": "19.1.5",
|
||||||
"@types/sanitize-html": "^2.16.0",
|
"@types/sanitize-html": "^2.16.0",
|
||||||
"cross-fetch": "^4.1.0",
|
"cross-fetch": "^4.1.0",
|
||||||
"eslint": "9.26.0",
|
"eslint": "9.27.0",
|
||||||
"eslint-config-next": "15.3.2",
|
"eslint-config-next": "15.3.2",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
"postcss": "8.5.3",
|
"postcss": "8.5.3",
|
||||||
"tailwindcss": "4.1.6",
|
"tailwindcss": "4.1.7",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "5.8.3"
|
"typescript": "5.8.3"
|
||||||
},
|
},
|
||||||
|
|||||||
2166
pnpm-lock.yaml
generated
2166
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,10 @@ import {
|
|||||||
} from '@/photo/ai';
|
} from '@/photo/ai';
|
||||||
import { getOrderedCategoriesFromString } from '@/category';
|
import { getOrderedCategoriesFromString } from '@/category';
|
||||||
import type { StorageType } from '@/platforms/storage';
|
import type { StorageType } from '@/platforms/storage';
|
||||||
import { makeUrlAbsolute, shortenUrl } from '@/utility/url';
|
import {
|
||||||
|
makeUrlAbsolute,
|
||||||
|
shortenUrl,
|
||||||
|
} from '@/utility/url';
|
||||||
|
|
||||||
// HARD-CODED GLOBAL CONFIGURATION
|
// HARD-CODED GLOBAL CONFIGURATION
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
import { POSTGRES_SSL_ENABLED } from '@/app/config';
|
import { POSTGRES_SSL_ENABLED } from '@/app/config';
|
||||||
import { Pool, QueryResult, QueryResultRow } from 'pg';
|
import { removeParamsFromUrl } from '@/utility/url';
|
||||||
|
import { Pool, QueryResult, QueryResultRow } from 'pg';
|
||||||
|
|
||||||
const pool = new Pool({
|
const pool = new Pool({
|
||||||
connectionString: process.env.POSTGRES_URL,
|
connectionString: removeParamsFromUrl(process.env.POSTGRES_URL, ['sslmode']),
|
||||||
...POSTGRES_SSL_ENABLED && { ssl: true },
|
...POSTGRES_SSL_ENABLED && { ssl: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -18,6 +18,14 @@ export const makeUrlAbsolute = (url?: string) => url !== undefined
|
|||||||
.replace(/\/$/, '')
|
.replace(/\/$/, '')
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
export const removeParamsFromUrl = (urlString = '', params: string[]) => {
|
||||||
|
const url = new URL(urlString);
|
||||||
|
for (const param of params) {
|
||||||
|
url.searchParams.delete(param);
|
||||||
|
}
|
||||||
|
return url.toString();
|
||||||
|
};
|
||||||
|
|
||||||
export const downloadFileFromBrowser = async (
|
export const downloadFileFromBrowser = async (
|
||||||
url: string,
|
url: string,
|
||||||
fileName: string,
|
fileName: string,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user