Update codebase to enhance debugging and improve user interface
The codebase has been updated throughout to improve debugging capabilities notably in the PostgresDatabaseWebhookVerifierService and create-reader modules. User interface has also been enhanced in the marketing layout and blog page. Minor reordering of entries in email-templates and adjustment of configurations in turbo.json has also been performed.
This commit is contained in:
@@ -9,10 +9,14 @@ export async function createKeystaticReader() {
|
||||
switch (STORAGE_KIND) {
|
||||
case 'local': {
|
||||
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
||||
const path = await import('node:path');
|
||||
const { default: config } = await import('./keystatic.config');
|
||||
const { createReader } = await import('@keystatic/core/reader');
|
||||
|
||||
return createReader('.', config);
|
||||
const contentPath = process.env.NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH;
|
||||
const repositoryPath = path.join(process.cwd(), contentPath as string);
|
||||
|
||||
return createReader(repositoryPath, config);
|
||||
} else {
|
||||
// we should never get here but the compiler requires the check
|
||||
// to ensure we don't parse the package at build time
|
||||
|
||||
@@ -4,11 +4,11 @@ const WEBHOOK_SENDER_PROVIDER =
|
||||
export async function getDatabaseWebhookVerifier() {
|
||||
switch (WEBHOOK_SENDER_PROVIDER) {
|
||||
case 'postgres': {
|
||||
const { PostgresDatabaseWebhookVerifierService } = await import(
|
||||
const { createDatabaseWebhookVerifierService } = await import(
|
||||
'./postgres-database-webhook-verifier.service'
|
||||
);
|
||||
|
||||
return new PostgresDatabaseWebhookVerifierService();
|
||||
return createDatabaseWebhookVerifierService();
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
@@ -10,12 +10,21 @@ const webhooksSecret = z
|
||||
.min(1)
|
||||
.parse(process.env.SUPABASE_DB_WEBHOOK_SECRET);
|
||||
|
||||
export class PostgresDatabaseWebhookVerifierService
|
||||
export function createDatabaseWebhookVerifierService() {
|
||||
return new PostgresDatabaseWebhookVerifierService();
|
||||
}
|
||||
|
||||
class PostgresDatabaseWebhookVerifierService
|
||||
implements DatabaseWebhookVerifierService
|
||||
{
|
||||
verifySignatureOrThrow(request: Request) {
|
||||
const header = request.headers.get('X-Supabase-Event-Signature');
|
||||
|
||||
console.log({
|
||||
header,
|
||||
webhooksSecret,
|
||||
});
|
||||
|
||||
if (header !== webhooksSecret) {
|
||||
throw new Error('Invalid signature');
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kit/eslint-config": "workspace:*",
|
||||
"@kit/i18n": "workspace:*",
|
||||
"@kit/prettier-config": "workspace:*",
|
||||
"@kit/tailwind-config": "workspace:*",
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@kit/i18n": "workspace:*"
|
||||
"@kit/tsconfig": "workspace:*"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
|
||||
@@ -44,7 +44,7 @@ export class ResendMailer implements Mailer {
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed to send email');
|
||||
throw new Error(`Failed to send email: ${res.statusText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user