質問編集履歴

8

ログ追加

2024/06/18 13:22

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -66,7 +66,19 @@
66
66
  ├── tailwind.config.ts
67
67
  └── tsconfig.json
68
68
  ```
69
-
69
+ そのときのpostgresqlのログです。
70
+ ```
71
+ 2024-06-16 19:19:01.541 JST [269] LOG: database system is ready to accept connections
72
+ 2024-06-16 19:20:36.275 JST [1714] postgres@blog_nextjs_crud FATAL: password authentication failed for user "postgres"
73
+ 2024-06-16 19:20:36.275 JST [1714] postgres@blog_nextjs_crud DETAIL: User "postgres" has no password assigned.
74
+ Connection matched file "/etc/postgresql/16/main/pg_hba.conf" line 125: "host all all 127.0.0.1/32 scram-sha-256"
75
+ 2024-06-16 19:50:58.307 JST [7667] postgres@blog_nextjs_crud FATAL: password authentication failed for user "postgres"
76
+ 2024-06-16 19:50:58.307 JST [7667] postgres@blog_nextjs_crud DETAIL: User "postgres" has no password assigned.
77
+ Connection matched file "/etc/postgresql/16/main/pg_hba.conf" line 125: "host all all 127.0.0.1/32 scram-sha-256"
78
+ 2024-06-16 19:51:22.893 JST [7854] postgres@blog_nextjs_crud FATAL: password authentication failed for user "postgres"
79
+ 2024-06-16 19:51:22.893 JST [7854] postgres@blog_nextjs_crud DETAIL: User "postgres" has no password assigned.
80
+ Connection matched file "/etc/postgresql/16/main/pg_hba.conf" line 125: "host all all 127.0.0.1/32 scram-sha-256"
81
+ ```
70
82
  ### 発生している問題・分からないこと
71
83
  prismaを使ってNext.jsでCRUDしたいんですがエラーがでます。
72
84
 

7

修正

2024/06/17 13:18

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -77,12 +77,7 @@
77
77
  npx prisma db pushの部分でエラーがでます。
78
78
  その前まではできています。
79
79
 
80
- ```
81
- blog-nextjs-crud#npx prisma db push
82
- Error: P1000: Authentication failed against database server at `localhost`, the provided database credentials for `postgres` are not valid.
83
80
 
84
- Please make sure to provide valid database credentials for the database server at `localhost`.
85
- ```
86
81
  ### エラーメッセージ
87
82
  ```error
88
83
  blog-nextjs-crud#npx prisma db push

6

修正

2024/06/17 13:17

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -52,16 +52,37 @@
52
52
  DATABASE_URL="postgresql://postgres:postgres@localhost:5432/blog_nextjs_crud?schema=public"
53
53
  ```
54
54
 
55
+ ```
56
+ ├── README.md
57
+ ├── next-env.d.ts
58
+ ├── next.config.mjs
59
+ ├── node_modules
60
+ ├── package-lock.json
61
+ ├── package.json
62
+ ├── postcss.config.mjs
63
+ ├── prisma
64
+ ├── public
65
+ ├── src
66
+ ├── tailwind.config.ts
67
+ └── tsconfig.json
68
+ ```
69
+
55
70
  ### 発生している問題・分からないこと
71
+ prismaを使ってNext.jsでCRUDしたいんですがエラーがでます。
72
+
56
73
  https://fajarwz.com/blog/simple-full-stack-crud-with-nextjs-14-postgresql-and-prisma/
57
- これ見てってるのですが
74
+ りたい。
58
75
 
76
+ 発生している問題・エラー
77
+ npx prisma db pushの部分でエラーがでます。
78
+ その前まではできています。
79
+
80
+ ```
59
81
  blog-nextjs-crud#npx prisma db push
60
-
61
82
  Error: P1000: Authentication failed against database server at `localhost`, the provided database credentials for `postgres` are not valid.
62
83
 
63
84
  Please make sure to provide valid database credentials for the database server at `localhost`.
64
-
85
+ ```
65
86
  ### エラーメッセージ
66
87
  ```error
67
88
  blog-nextjs-crud#npx prisma db push

5

修正

2024/06/17 13:14

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -18,6 +18,35 @@
18
18
  | | | | | | | | postgres=CTc/postgres
19
19
  (4 rows)
20
20
  ```
21
+
22
+ ```schema.prisma
23
+ // prisma/schema.prisma
24
+
25
+ // This is your Prisma schema file,
26
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
27
+
28
+ // Generate the Prisma Client in JavaScript
29
+ generator client {
30
+ provider = "prisma-client-js"
31
+ }
32
+
33
+ // This block of code defines the database connection. The database is a PostgreSQL database.
34
+ // The database connection URL will be read from an environment variable named `DATABASE_URL`.
35
+ datasource db {
36
+ provider = "postgresql"
37
+ url = env("DATABASE_URL")
38
+ }
39
+
40
+ // This block of code defines a Post model
41
+ model Post {
42
+ id String @id @default(cuid())
43
+ title String @db.VarChar(255) // will generate VARCHAR
44
+ content String // will generate TEXT
45
+ createdAt DateTime @default(now())
46
+ updatedAt DateTime @updatedAt
47
+ }
48
+ ```
49
+
21
50
  .envファイル
22
51
  ```
23
52
  DATABASE_URL="postgresql://postgres:postgres@localhost:5432/blog_nextjs_crud?schema=public"

4

修正

2024/06/15 13:57

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
  npx prisma db pushでエラーがでないようにしたい。
3
3
  環境 WSL2 ubuntu24.04
4
4
 
5
-
5
+ ```
6
6
  psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
7
7
  Type "help" for help.
8
8
 
@@ -17,6 +17,11 @@
17
17
  template1 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
18
18
  | | | | | | | | postgres=CTc/postgres
19
19
  (4 rows)
20
+ ```
21
+ .envファイル
22
+ ```
23
+ DATABASE_URL="postgresql://postgres:postgres@localhost:5432/blog_nextjs_crud?schema=public"
24
+ ```
20
25
 
21
26
  ### 発生している問題・分からないこと
22
27
  https://fajarwz.com/blog/simple-full-stack-crud-with-nextjs-14-postgresql-and-prisma/

3

誤字

2024/06/15 13:52

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -3,7 +3,6 @@
3
3
  環境 WSL2 ubuntu24.04
4
4
 
5
5
 
6
- psql -U postgres
7
6
  psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
8
7
  Type "help" for help.
9
8
 
@@ -16,8 +15,8 @@
16
15
  template0 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
17
16
  | | | | | | | | postgres=CTc/postgres
18
17
  template1 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
19
- | | | | | |
18
+ | | | | | | | | postgres=CTc/postgres
20
-
19
+ (4 rows)
21
20
 
22
21
  ### 発生している問題・分からないこと
23
22
  https://fajarwz.com/blog/simple-full-stack-crud-with-nextjs-14-postgresql-and-prisma/

2

誤字

2024/06/15 13:50

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,5 @@
1
1
  ### 実現したいこと
2
2
  npx prisma db pushでエラーがでないようにしたい。
3
- 環境
4
3
  環境 WSL2 ubuntu24.04
5
4
 
6
5
 

1

環境情報を載せました。

2024/06/15 13:49

投稿

gabakugik
gabakugik

スコア13

test CHANGED
File without changes
test CHANGED
@@ -1,5 +1,24 @@
1
1
  ### 実現したいこと
2
2
  npx prisma db pushでエラーがでないようにしたい。
3
+ 環境
4
+ 環境 WSL2 ubuntu24.04
5
+
6
+
7
+ psql -U postgres
8
+ psql (16.3 (Ubuntu 16.3-0ubuntu0.24.04.1))
9
+ Type "help" for help.
10
+
11
+ postgres=# \list
12
+ List of databases
13
+ Name | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
14
+ ------------------+----------+----------+-----------------+---------+---------+------------+-----------+-----------------------
15
+ blog_nextjs_crud | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | |
16
+ postgres | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | |
17
+ template0 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
18
+ | | | | | | | | postgres=CTc/postgres
19
+ template1 | postgres | UTF8 | libc | C.UTF-8 | C.UTF-8 | | | =c/postgres +
20
+ | | | | | |
21
+
3
22
 
4
23
  ### 発生している問題・分からないこと
5
24
  https://fajarwz.com/blog/simple-full-stack-crud-with-nextjs-14-postgresql-and-prisma/