blitz-js / blitz-js/blitz

Fresh blitz template project fails building because of type error

Open
#4,201 4 comments 0 reactions 1 assignee Claimed by @siddhsuresh View on GitHub
kind/bug status/assigned
Dominant language
TypeScript
Stars
14.1k
Forks
803
PR merge metrics
No merged PRs in 30d

Description

### What is the problem?

Build fails because of type errors immediately after setting up a blitz template with the following settings:

**Project Language**: TypeScript
**App Template**: Full - includes DB and auth (Recommended)
**Install dependencies?**: pnpm
**Pick a form library**: React Hook Form

### Paste all your error logs here:

```
~\Source\espenja
λ blitz new blitztest
√ Pick a new project's language » TypeScript
√ Pick your new app template » Full - includes DB and auth (Recommended)
√ Install dependencies? » pnpm
√ Pick a form library (you can switch to something else later if you want) » React Hook Form
Hang tight while we set up your new Blitz app!
CREATE .env
CREATE .env.local
CREATE .env.test
CREATE .eslintrc.js
CREATE README.md
CREATE db\index.ts
CREATE db\migrations\.keep
CREATE db\schema.prisma
CREATE db\seeds.ts
CREATE integrations\.keep
CREATE mailers\.keep
CREATE mailers\forgotPasswordMailer.ts
CREATE next-env.d.ts
CREATE next.config.js
CREATE package.json
CREATE public\favicon.ico
CREATE public\logo.png
CREATE src\auth\components\LoginForm.tsx
CREATE src\auth\components\SignupForm.tsx
CREATE src\auth\mutations\changePassword.ts
CREATE src\auth\mutations\forgotPassword.test.ts
CREATE src\auth\mutations\forgotPassword.ts
CREATE src\auth\mutations\login.ts
CREATE src\auth\mutations\logout.ts
CREATE src\auth\mutations\resetPassword.test.ts
CREATE src\auth\mutations\resetPassword.ts
CREATE src\auth\mutations\signup.ts
CREATE src\auth\schemas.ts
CREATE src\blitz-client.ts
CREATE src\blitz-server.ts
CREATE src\core\components\Form.tsx
CREATE src\core\components\LabeledTextField.tsx
CREATE src\core\layouts\Layout.tsx
CREATE src\pages\404.tsx
CREATE src\pages\_app.tsx
CREATE src\pages\_document.tsx
CREATE src\pages\api\rpc\[[...blitz]].ts
CREATE src\pages\auth\forgot-password.tsx
CREATE src\pages\auth\login.tsx
CREATE src\pages\auth\reset-password.tsx
CREATE src\pages\auth\signup.tsx
CREATE src\pages\index.tsx
CREATE src\styles\Home.module.css
CREATE src\styles\globals.css
CREATE src\users\hooks\useCurrentUser.ts
CREATE src\users\queries\getCurrentUser.ts
CREATE test\index.test.tsx
CREATE test\setup.ts
CREATE test\utils.tsx
CREATE tsconfig.json
CREATE types.ts
CREATE vitest.config.ts

✔ Retrieving the freshest of dependencies
✔ Installing those dependencies (this will take a few minutes)
✔ Formatting your code
✔ Committing your app

Your new Blitz app is ready! Next steps:
1. cd blitztest
2. blitz dev

~\Source\espenja took 1m12s
λ cd .\blitztest\

blitztest on  main via  v20.5.1
λ pnpm build

> blitztest@1.0.0 build \Source\espenja\blitztest
> blitz build

Loaded env from \Source\espenja\blitztest\.env.local
Loaded env from \Source\espenja\blitztest\.env
\Source\espenja\blitztest\node_modules\.pnpm\next@13.4.5_@babel+core@7.22.10_react-dom@18.2.0_react@18.2.0\node_modules\next\dist\client\index.js
✔ Next.js was successfully patched with a React Suspense fix
✔ Routes manifest was successfully generated
- info Linting and checking validity of types ...Failed to compile.

./src/blitz-server.ts:16:3
Type error: Type 'import("/Source/espenja/blitztest/node_modules/.pnpm/tslog@4.9.0/node_modules/tslog/dist/types/index").Logger/Source/espenja/blitztest/node_modules/.pnpm/tslog@4.9.0/node_modules/tslog/dist/types/interfaces").ILogObj>' is not assignable to type 'import("/Source/espenja/blitztest/node_modules/.pnpm/tslog@4.9.1/node_modules/tslog/dist/types/index").Logger/Source/espenja/blitztest/node_modules/.pnpm/tslog@4.9.1/node_modules/tslog/dist/types/interfaces").ILogObj>'.
Types have separate declarations of a private property 'logObj'.

14 | }),
15 | ],
> 16 | logger: BlitzLogger({}),
| ^
17 | })
18 |
 ELIFECYCLE  Command failed with exit code 1.

blitztest on  main [!] via  v20.5.1 took 11s
λ
```

### Paste all relevant code snippets here:

```typescript
// ./src/blitz-server.ts
import { setupBlitzServer } from "@blitzjs/next"
import { AuthServerPlugin, PrismaStorage } from "@blitzjs/auth"
import { simpleRolesIsAuthorized } from "@blitzjs/auth"
import { BlitzLogger } from "blitz"
import db from "db"
import { authConfig } from "./blitz-client"

export const { gSSP, gSP, api } = setupBlitzServer({
plugins: [
AuthServerPlugin({
...authConfig,
storage: PrismaStorage(db),
isAuthorized: simpleRolesIsAuthorized,
}),
],
logger: BlitzLogger({}), // <-- type error
})

```

### What are detailed steps to reproduce this?

`> blitz new blitztest`
√ Pick a new project's language » **TypeScript**
√ Pick your new app template » **Full - includes DB and auth (Recommended)**
√ Install dependencies? » **pnpm**
√ Pick a form library (you can switch to something else later if you want) » **React Hook Form**

`> pnpm build`

### Run `blitz -v` and paste the output here:

```
Blitz version: 2.0.0-beta.32 (global)
Blitz version: 2.0.0-beta.32 (local)
Windows 11 | win32-x64 | Node: v20.5.1

Package manager: pnpm

System:
OS: Windows 10 10.0.22621
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 16.22 GB / 31.70 GB
Binaries:
Node: 20.5.1 - ~\AppData\Local\pnpm\node.EXE
Yarn: 1.22.19 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 9.8.0 - ~\AppData\Local\pnpm\npm.CMD
npmPackages:
@blitzjs/auth: 2.0.0-beta.32 => 2.0.0-beta.32
@blitzjs/next: 2.0.0-beta.32 => 2.0.0-beta.32
@blitzjs/rpc: 2.0.0-beta.32 => 2.0.0-beta.32
@prisma/client: 4.6.1 => 4.6.1
blitz: 2.0.0-beta.32 => 2.0.0-beta.32
next: 13.4.5 => 13.4.5
prisma: 4.6.1 => 4.6.1
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
typescript: ^4.8.4 => 4.8.4

```

### Please include below any other applicable logs and screenshots that show your problem:

![image](https://github.com/blitz-js/blitz/assets/1131968/5e4ffe87-de32-4678-ae8e-5cd879366abd)
![image](https://github.com/blitz-js/blitz/assets/1131968/bfd60397-2283-4da4-b5fb-92543176f45f)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.