0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

supabaseでデータベースの設定が上手くいかなかった話

Posted at

この記事ではNextjsのsupabaseにおけるデータベース設定で起きたエラーについて書きます

起きたエラー P1013

PS 当該フォルダ> npx prisma migrate dev --name init
>> 
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database

Error: P1013: The provided database string is invalid. invalid port number in database URL. Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.

なぜ起きたのか?

内容から.envの読み込みより
supabaseからデータベースをアドレスをもってきましたが
そのままコピペしただけなのにどういうことか

プロジェクトの上部のconnectから
db1-m.png

session poolerより
db2-m.png

your-passwordの部分を自分のにしっかり変えて張り付けたのにも関わらず

.env
# .envより
DATABASE_URL="postgresql://postgres.・・・・:[your-password]"

解決方法

パスワードの特殊文字をエンコードで解決しました。
なぜか特殊文字(@,#,!他)は適用外なので
下記のリンクでまるまる変換してなんとかしました。
https://tech-unlimited.com/urlencode.html

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?