Skip to content

Commit 8663024

Browse files
docs: add mention of the useUploadHandlers error and steps to remedy it with a mention to monorepos (#14233)
Closes #13353 Updated documentation to mention the `useUploadHandlers` error, most commonly triggered in monorepos where different apps end up resolving to different dependencies in particular of nextjs or react --------- Co-authored-by: German Jablonski <[email protected]>
1 parent 54224c3 commit 8663024

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/troubleshooting/troubleshooting.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,18 @@ pnpm dedupe
111111

112112
Absolute last resort: add Webpack aliases so that all imports of a given package resolve to the same path (e.g. `resolve.alias['react'] = path.resolve('./node_modules/react')`). Keep this only until you can fix the underlying version skew.
113113

114+
### Monorepos
115+
116+
Another error you might see is the following or similarly related to hooks, in particular when `next` versions are mismatched:
117+
118+
```bash
119+
useUploadHandlers must be used within UploadHandlersProvider
120+
```
121+
122+
This is a common pitfall when using a monorepo setup with multiple packages. In this case, ensure that all packages in the monorepo use the same version of `payload`, `@payloadcms/*`, `next`, `react`, and `react-dom`. You can use pnpm with workspaces to manage dependencies across packages in a monorepo effectively. Unfortunately this error becomes harder to debug inside a monorepo due to how package managers hoist dependencies as well as resolve them.
123+
124+
If you've pinned the versions and the error persists we recommend removing `.next/`, `node_modules/` and if possible deleting the lockfile and re-generating it to ensure that all packages in the monorepo are using the same version of the dependencies mentioned above.
125+
114126
## "Unauthorized, you must be logged in to make this request" when attempting to log in
115127

116128
This means that your auth cookie is not being set or accepted correctly upon logging in. To resolve check the following settings in your Payload Config:

0 commit comments

Comments
 (0)