-
コード
tfenvをインストールしてterraformを使えるようにする
【tfenvをインストール(mac)】 terraformはバージョンが頻繁に更新されるので、tfenvを使ってバージョン管理をします。 brewを使ってtfenv をインストール。 $ brew install tfenv tfenvは3をインストールしました。 $ tfenv -v tfenv 3.0.0 次に現在使... -
AWS
Error: Error creating VPC: UnauthorizedOperation: You are not authorized to perform this operation.
【はじめに】 初めてterraformを使用したときに、「Error: Error creating VPC: UnauthorizedOperation: You are not authorized to perform this operation.」というエラーがでました。 その解決方法をまとめます。 【問題】 terraform applyをすると次の... -
Next.js
Parsing error: DeprecationError: ‘originalKeywordKind’ has been deprecated since v5.0.0 and can no longer be used. Use ‘identifierToKeywordKind(identifier)’ instead.
Next.js13のtypescriptのバージョンをアップグレードしたら、 Parsing error: DeprecationError: 'originalKeywordKind' has been deprecated since v5.0.0 and can no longer be used. Use 'identifierToKeywordKind(identifier)' instea... -
Next.js
Next.js13のApp RouterでMaterial UI を使う
Material UIのバージョン5.14.0からNext.jsのApp Routerがサポートされたので、Material UIを使用するために"use client"を書く必要はありません。 このきじはこちらのgitリポジトリを参考にしています。 【muiをインストール】 まずはmuiをインストールし... -
Next.js
Next.js13のapp routerのapiにPOSTしたbodyデータを取得する
postしたデータはconst res = await request.json();することによってbodyデータを取得することができる。 import { NextResponse, NextRequest } from "next/server"; export async function POST(request: NextRequest) { const res = await r... -
Next.js
Next.js13のapp routerのapiでgetパラメータを取得
getパラメータはrequest.nextUrl.searchParamsで取得できる。 https://nextjs.org/docs/app/api-reference/functions/next-request#nexturl import { NextResponse, NextRequest } from "next/server"; import prisma from "@/lib/prisma&q... -
コード
Row count exceeded 100,000
PlanetScaleからデータを取得する時に出るこのエラーの原因と解決方法この記事で解説します。 Error: Invalid `prisma.post.findMany()` invocation: Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, k... -
コード
Prismaでリレーション付きの型を取得する
このようなテーブルを作ったとき、特定のユーザーと一緒にリレーション先のPostのデータもほしいときがよくあります。 model User { id String @id @default(auto()) @map("_id") @db.ObjectId posts Post[] } model Post { id String @id @defa... -
Next.js
Next.jsでPrismaが実行したクエリの各種ログをコンソール表示する
Prismaでは実行したクエリの警告、エラーなどを次のようにコンソールに表示することができます。 Query: SELECT "public"."User"."id", "public"."User"."email", "public"."... -
Next.js
Next.jsを最小のイメージサイズでCloudRunにデプロイする
この記事ではNext.js13をCloudRunにデプロイすることを想定しています。 Next.jsのstandalone機能を使うと通常のビルドと比較して小さいサイズになります。経験上、だいたい半分ぐらいのビルドサイズになるので必ず使います。 const nextConfig = { ... ou...