Skip to content

Commit b216cfe

Browse files
committed
fix
1 parent 3289d31 commit b216cfe

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

dashboard/final-example/app/lib/actions.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use server';
22

33
import { z } from 'zod';
4-
import postgres from 'postgres'
4+
import postgres from 'postgres';
55
import { revalidatePath } from 'next/cache';
66
import { redirect } from 'next/navigation';
77
import { signIn } from '@/auth';
88
import { AuthError } from 'next-auth';
99

10-
const sql = postgres(process.env.POSTGRES_URL!)
10+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
1111

1212
const FormSchema = z.object({
1313
id: z.string(),

dashboard/final-example/app/lib/data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from './definitions';
1010
import { formatCurrency } from './utils';
1111

12-
const sql = postgres(process.env.POSTGRES_URL!);
12+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
1313

1414
export async function fetchRevenue() {
1515
try {

dashboard/final-example/app/seed/route.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import bcrypt from 'bcrypt';
2-
import postgres from 'postgres'
2+
import postgres from 'postgres';
33
import { invoices, customers, revenue, users } from '../lib/placeholder-data';
44

5-
const sql = postgres(process.env.POSTGRES_URL!)
5+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
66

77
async function seedUsers() {
88
await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;
@@ -103,12 +103,12 @@ async function seedRevenue() {
103103

104104
export async function GET() {
105105
try {
106-
const result = await sql.begin(sql => [
106+
const result = await sql.begin((sql) => [
107107
seedUsers(),
108108
seedCustomers(),
109109
seedInvoices(),
110110
seedRevenue(),
111-
])
111+
]);
112112

113113
return Response.json({ message: 'Database seeded successfully' });
114114
} catch (error) {

dashboard/final-example/auth.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import NextAuth from 'next-auth';
22
import Credentials from 'next-auth/providers/credentials';
33
import bcrypt from 'bcrypt';
4-
import postgres from 'postgres'
4+
import postgres from 'postgres';
55
import { z } from 'zod';
66
import type { User } from '@/app/lib/definitions';
77
import { authConfig } from './auth.config';
88

9-
const sql = postgres(process.env.POSTGRES_URL!)
9+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
1010

1111
async function getUser(email: string): Promise<User | undefined> {
1212
try {

dashboard/starter-example/app/lib/data.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
} from './definitions';
1010
import { formatCurrency } from './utils';
1111

12-
const sql = postgres(process.env.POSTGRES_URL!);
12+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
1313

1414
export async function fetchRevenue() {
1515
try {

dashboard/starter-example/app/seed/route.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import bcrypt from 'bcrypt';
2-
import postgres from 'postgres'
2+
import postgres from 'postgres';
33
import { invoices, customers, revenue, users } from '../lib/placeholder-data';
44

5-
const sql = postgres(process.env.POSTGRES_URL!)
5+
const sql = postgres(process.env.POSTGRES_URL!, { ssl: 'require' });
66

77
async function seedUsers() {
88
await sql`CREATE EXTENSION IF NOT EXISTS "uuid-ossp"`;
@@ -103,12 +103,12 @@ async function seedRevenue() {
103103

104104
export async function GET() {
105105
try {
106-
const result = await sql.begin(sql => [
106+
const result = await sql.begin((sql) => [
107107
seedUsers(),
108108
seedCustomers(),
109109
seedInvoices(),
110110
seedRevenue(),
111-
])
111+
]);
112112

113113
return Response.json({ message: 'Database seeded successfully' });
114114
} catch (error) {

0 commit comments

Comments
 (0)