Open espenja opened 1 year ago
Likewise, it's probable that an error has occurred due to tslog. I'll describe the error in detail below.
When attempting to log in with an incorrect password, a "Bad Request" error message appears.
Project Language: TypeScript App Template: Full - includes DB and auth (Recommended) Install dependencies?: yarn Pick a form library: React Final Form (recommended)
2023-08-21 09:36:37.757 INFO [blitz-rpc] getCurrentUser() Starting with input: null
2023-08-21 09:36:37.757 DEBUG [blitz-rpc] getCurrentUser() Result: null
2023-08-21 09:36:37.757 DEBUG [blitz-rpc] getCurrentUser() Next.js serialization:0ms
2023-08-21 09:36:37.758 INFO [blitz-rpc] getCurrentUser() Finished: resolver:0ms serializer:1ms total:1ms
2023-08-21 09:36:42.726 INFO [blitz-rpc] login() Starting with input: {
email: 'example@example.com',
password: '[***]'
}
[AuthenticationError: You must be logged in to access this] {
statusCode: 401
}
Error while processing the request
TypeError: Cannot read properties of undefined (reading 'map')
at prettyFormatErrorObj (/Users/example/Desktop/myAppName/node_modules/tslog/dist/cjs/runtime/nodejs/index.js:95:47)
at maskedArgs.reduce.args (/Users/example/Desktop/myAppName/node_modules/tslog/dist/cjs/runtime/nodejs/index.js:89:43)
at Array.reduce (<anonymous>)
at Object.prettyFormatLogObj (/Users/example/Desktop/myAppName/node_modules/tslog/dist/cjs/runtime/nodejs/index.js:88:23)
at Logger.log (/Users/example/Desktop/myAppName/node_modules/tslog/dist/cjs/BaseLogger.js:111:77)
at Logger.error (/Users/example/Desktop/myAppName/node_modules/tslog/dist/cjs/index.js:51:22)
at /Users/example/Desktop/myAppName/node_modules/@blitzjs/rpc/dist/index-server.cjs:326:15
at Generator.throw (<anonymous>)
at rejected (/Users/example/myAppName/node_modules/@blitzjs/rpc/dist/index-server.cjs:127:29)
<Form
submitText="Login"
schema={Login}
initialValues={{ email: "", password: "" }}
onSubmit={async (values) => {
try {
const user = await loginMutation(values)
props.onSuccess?.(user)
} catch (error: any) {
if (error instanceof AuthenticationError) {
return { [FORM_ERROR]: "Sorry, those credentials are invalid" }
} else {
return {
[FORM_ERROR]:
"Sorry, we had an unexpected error. Please try again. - " + error.toString(),
}
}
}
}}
>
blitz new myAppName
with the following options:
Pick a new project's language › TypeScript
Pick your new app template › Full - includes DB and auth (Recommended)
Install dependencies? › yarn
Pick a form library (you can switch to something else later if you want) > Select React Final Form (recommended)cd myAppName
yarn blitz dev
Blitz version: 2.0.0-beta.32 (local)
macOS Ventura | darwin-arm64 | Node: v20.4.0
Package manager: npm
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M1
Memory: 649.81 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.4.0 - /var/folders/4g/cxm9ykgj3233ntyv30k5db2c0000gn/T/yarn--1692579171845-0.5899365927776306/node
Yarn: 1.22.19 - /var/folders/4g/cxm9ykgj3233ntyv30k5db2c0000gn/T/yarn--1692579171845-0.5899365927776306/yarn
npm: 9.7.2 - ~/.asdf/plugins/nodejs/shims/npm
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.9.5
@justinsmid Can you take a look at this ? thx
Seems like setupBlitzServer
expects logger
to be a tslog Logger
object of tslog version 4.9.2
, but BlitzLogger
returns one of version 4.9.0
.
I do not know why the "blitz"
(which exports BlitzLogger
) and "@blitzjs/next"
(which exports setupBlitzServer
) packages seemingly use different tslog versions.
If I had to guess why, from a quick glance, I would suspect this "*"
version used here by blitz-next
is causing it to use the latest version where blitz
's package.json has its tslog version hard-set at 4.9.0, but I am not sure, and don't actually know anything about blitz's code itself and/or why this is the case.
thanks for the issue @espenja and your suggestion @justinsmid taking a look now.
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:
Paste all relevant code snippets here:
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:Please include below any other applicable logs and screenshots that show your problem: