Fixing Next.js server component errors
This error occurs when you create a Liveblocks data structure (
LiveMap) within a server component. This is often occurs when
creating a room with
RoomProvider, for example:
This can be fixed by turning the file into a client file with
"use client"; at
the top of the file. However, if your need a server component, you can extract
the provider to a different file.
To take this further, and to learn how to structure your Next.js app in the best possible way, make sure to read our How to use Liveblocks with Next.js /app directory guide.