Setting up a Gitlab CI for my nestjs project using prisma has been my current challenge. I keep encountering this error when running the pipeline: see image here
This is what my .gitlab-ci.yml looks like:
image: node:latest
stages:
- build
build:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm install
- npx prisma generate
- pnpm run build
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
artifacts:
paths:
- dist
user.models.ts
:
import { User } from "@prisma/client"; # The line causing issues in the CI build
import { IsEmail, IsInt, IsNotEmpty, IsString } from "class-validator";
class UserModel implements User {
@IsNotEmpty()
@IsInt()
id: number;
@IsNotEmpty()
@IsString()
@IsEmail()
email: string;
@IsNotEmpty()
@IsString()
password: string;
}
When I run pnpm run build
locally, it works perfectly.
I've even checked the output generated by prisma manually with these commands, and confirmed that User
is being exported as a type from index.d.ts
.
- cd ./node_modules/.prisma/client
- cat index.d.ts
- cd ../../..