⚡️ The Missing Fullstack Toolkit for Next.js
3bcbad1a9: - Introduce Blitz RPC's logging system to the invoke
function which is the recommended way to call resolvers in nextjs app
directory's react server components.
blitz-auth
and blitz-rpc
, allowing independent usage of blitz-rpc
You can now configure the usage of invoke
in the app directory with custom error handling logic and controlling the verbosity of the logger in the following way:
// blitz-server.ts
import { notFound } from "next/navigation"
...
RpcServerPlugin({
logging: {
allowList: [] // if allowList is defined then only those routes will be logged
blockList: [] // If blockList is defined then all routes except those will be logged
disablelevel: "info|debug" // Represents the flag to enable/disable logging for a particular level
verbose: true, // enable/disable logging If verbose is true then Blitz RPC will log the input and output of each resolver
},
onInvokeError(error) {
if(error instanceof NotFoundError) {
notFound()
}
},
}),
b97366c42: Remove unintended dependency on next-auth by removing it from the core build of @blitzjs/auth
Update your import in next.config.js
in the following way
-const { withNextAuthAdapter } = require("@blitzjs/auth")
+const { withNextAuthAdapter } = require("@blitzjs/auth/next-auth")
cee2dec17: Fix bug that did not allow Page.authenicate = {role: "" }
to correctly work
aec1bb076: blitz-next: Fix next/head
used in app directory warning
c89cb943b: Upgrade next, prisma and zod to latest versions in a newly created app
3ddb57072:
⚠️ Important:
Next.js version 13.5 or above is now required to use @blitzjs/next
Fix Error: Cannot find module 'next/dist/shared/lib/router/utils/resolve-href'
by updating the location of next.js internal function.
30fd61316:
blitz new
menuformik
the default/recommended form libraryfe8c937d2: Remove rouge console.log
during start
.tsx
& .jsx
file extensions to be used for resolversTypeError: Cannot read properties of undefined (reading 'map')
while using custom errors.ts-log
peer dependency to 4.9.0
javascript
from blitz new
menuUpdate Schema
when using blitz generator4.9.0
.
This due a tslog issue that causes tslog to crash when attempting to log an error whose constructor expects more than one argument.useAuthenticatedBlitzContext
to now return AuthenticatedCtx
727734955: ### Now we can configure Blitz RPC in the following way,
In your [[...blitz]].ts
api file you can see the following settings
logging?: {
/**
* allowList Represents the list of routes for which logging should be enabled
* If whiteList is defined then only those routes will be logged
*/
allowList?: string[]
/**
* blockList Represents the list of routes for which logging should be disabled
* If blockList is defined then all routes except those will be logged
*/
blockList?: string[]
/**
* verbose Represents the flag to enable/disable logging
* If verbose is true then Blitz RPC will log the input and output of each resolver
*/
verbose?: boolean
/**
* disablelevel Represents the flag to enable/disable logging for a particular level
*/
disablelevel?: "debug" | "info"
}
import { rpcHandler } from "@blitzjs/rpc"
import { api } from "src/blitz-server"
export default api(
rpcHandler({
onError: console.log,
formatError: (error) => {
error.message = `FormatError handler: ${error.message}`
return error
},
logging: {
...
}
})
)
Example:
export default api(
rpcHandler({
onError: console.log,
formatError: (error) => {
error.message = `FormatError handler: ${error.message}`
return error
},
logging: {
verbose: true,
blockList: ["getCurrentUser", ...], //just write the resolver name [which is the resolver file name]
},
})
)
This is enable verbose blitz rpc logging for all resolvers except the resolvers getCurrentUser
and others mentioned in the blockList
Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]
Unable to use next-auth with provider: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]
1bb3a6556: Stop exporting useAuthenticatedBlitzContext
from @blitzjs/auth
this must be imported from app/blitz-server.ts
file in order to work correctly
5166e5e03: (feat) upgrade tslog to v4.8.2
c7ac86b85: Fixes enormous memory consumption of the dev server by changing the default import strategy to require
instead of import
which in webpack causes multiple chunks to be created for each import.
To configure this behaviour, you can add the following to your next.config.js:
/**
* @type {import('@blitzjs/next').BlitzConfig}
**/
const config = {
blitz: {
resolversDynamicImport: true,
},
}
When resolversDynamicImport
is set to true
, the import strategy will be "import" instead of "require".
If you are using Vercel, resolversDynamicImport
will be set to true
by default, since it is better for the separate chunks to be create for serverless lambdas.
5166e5e03: (feat) upgrade tslog to v4.8.2
2533caf48: Fix return type of requestMiddlewares
in RpcServerPlugin
Full Changelog: https://github.com/blitz-js/blitz/compare/v2.0.0-beta.27...v2.0.0-beta.28