Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/multi-tenant references "@payloadcms/plugin-multi-tenant": "file:payloadcms-plugin-multi-tenant-3.15.1.tgz", #10602

Open
rsigg opened this issue Jan 15, 2025 · 5 comments · May be fixed by #10702
Assignees

Comments

@rsigg
Copy link

rsigg commented Jan 15, 2025

Describe the Bug

The examples/multi-tenant on the main branch has a reference to file:payloadcms-plugin-multi-tenant-3.15.1.tgz and not an actual version of the plugin.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/examples/multi-tenant/package.json

Reproduction Steps

Open the file https://github.com/payloadcms/payload/blob/main/examples/multi-tenant/package.json and see the file referenced on line 21.

Which area(s) are affected? (Select all that apply)

plugin: other

Environment Info

Payload: branch/main - 3.17.1
@rsigg rsigg added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 15, 2025
@JarrodMFlesch JarrodMFlesch self-assigned this Jan 15, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 15, 2025
@pianetarosso
Copy link

I've tried compressing and importing the code found in payload/packages/plugin-multi-tenant inside the generated project.

Running npm install throws the error:

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

Switching to yarn solves this error, and running yarn dev starts the project correctly.

Triyng to access localhost:3000/admin throws the following error

Import trace for requested module:
./src/app/(payload)/admin/importMap.js
./src/app/(payload)/layout.tsx
 ⨯ ./node_modules/@payloadcms/plugin-multi-tenant/src/exports/client.ts:1:1
Module not found: Can't resolve '../components/TenantField/index.client.js'
> 1 | export { TenantField } from '../components/TenantField/index.client.js'
    | ^
  2 | export { TenantSelector } from '../components/TenantSelector/index.js'
  3 |

https://nextjs.org/docs/messages/module-not-found

@sabinayakc
Copy link

sabinayakc commented Jan 17, 2025

Having the same issue.

I even tried doing in my package.json but then all the configuration started erroring out.

    "@payloadcms/plugin-multi-tenant": "^0.0.1",

Looks like the multi configuration fields have changed as well.

@bratvanov
Copy link
Contributor

For now, the package.json can be manually updated to "@payloadcms/plugin-multi-tenant": "latest", and re-running pnpm install should get the plugin from npmjs.

@pianetarosso I also ran into the Module not found error, which I fixed by pnpm (yarn/npm) run generate:importmap.

@sabinayakc
Copy link

@bratvanov looks like they just released the latest version to npmjs.

Ill give it a try. Earlier, the only version that was available was 0.0.1 which was pretty old and outdated.

Image

@pianetarosso
Copy link

I've tried the fixes you suggested. I'm getting new errors now.

The requested module 'payload' does not provide an export named 'mergeHeaders' in @payloadcms/plugin-multi-tenant/src/hooks/afterTenantDelete.ts because mergeHeaders should be imported as import { mergeHeaders } from '@payloadcms/next/utilities'

After fixing this you can run pnpm run generate:importmap without errors, the server also starts.

Trying to access the admin section throws this error: TypeError: Cannot read properties of undefined (reading 'find') in plugin-multi-tenant/dist/providers/TenantSelectionProvider/index.js

Image

And I don't know how to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants