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

Exception: There is no active transaction #772

Closed
kkbt opened this issue Jan 1, 2022 · 3 comments
Closed

Exception: There is no active transaction #772

kkbt opened this issue Jan 1, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@kkbt
Copy link

kkbt commented Jan 1, 2022

Bug description

For every new registered user, a new tenant (with database) should be created automatically.
Above mentioned exception is raised when trying to register a new user.
Without the event listener (trying to create a new tenant upon user registration) no such exception is raised.

Steps to reproduce

Shell script (link)

Expected behavior

Creating a new tenant (with database).

Laravel version

8.77.1

stancl/tenancy version

3.4.6

@kkbt kkbt added the bug Something isn't working label Jan 1, 2022
@stancl
Copy link
Member

stancl commented Jan 1, 2022

It's a bit hard to understand the code from the shell script. But either way, this is not a bug with the package and is related to your use.

A couple of things to note:

  • Laravel cannot run cross-db queries or Schema::create() when inside a transaction
  • I don't see the point of having tenants and teams linked 1:1 yet as separate entities. Why not make the teams your tenants?
  • Jetstream is not supported in v3 anyway. There's information about this on our Discord

@stancl stancl closed this as completed Jan 1, 2022
@kkbt
Copy link
Author

kkbt commented Jan 1, 2022

Thank you for the quick and helpful answer.
Making the teams tenants would be the best way, however, I'm not experienced with this tenancy package to see how to implement this right away.
As of my knowledge, teams are provided by Jetstream only: https://jetstream.laravel.com/2.x/features/teams.html
So if v3 of Tenancy for Laravel doesn't support Jetstream, it also doesn't support teams (if I am not mistaken), which means it can't be used for this purpose (teams = tenants).
I found your explanation here: laravel/framework#40165

Motivation

In v3 of Tenancy for Laravel, one of the biggest limitations our users deal with is that controllers which use constructor DI are incompatible with multi-tenancy.

This means that Fortify, Jetstream, and many other packages cannot be used out of the box.

@kkbt
Copy link
Author

kkbt commented Jan 1, 2022

See also: laravel/framework#40165 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants