Server Error 500 on login: api tokens are no longer available?

I’m not able to login anymore - but another user is working?
No update, no changes on server…

production.ERROR: App\Transformers\CompanyTokenTransformer::transform(): Argument #1 ($company_token) must be of type App\Models\CompanyToken, null given, called in /home/customer/www/invoice.XX.com/public_html/vendor/league/fractal/src/Scope.php on line 357 {“userId”:1,“exception”:"[object] (TypeError(code: 0): App\Transformers\CompanyTokenTransformer::transform(): Argument #1 ($company_token) must be of type App\Models\CompanyToken, null given, called in /home/customer/www/invoice.XX.com/public_html/vendor/league/fractal/src/Scope.php on line 357 at /home/customer/www/invoice.photo-motions.ch/public_html/app/Transformers/CompanyTokenTransformer.php:41)
[stacktrace]

Any hint what to do?

Hi,

I see the same error referenced in this post, has anything changed on your server?

No luck :frowning:

  • I did not change anything on the server.
  • Another user (not Admin) is able to log in
  • tried loading /update?secret=secret and running php artisan optimize → no change, still getting 500 error on login.

Apparently the non working user has no company_token entry?
How do I create one?

SELECT * FROM company_tokens shows:

  • One newly created token name=“Dart/2.18 (dart:io)” for the working user :slight_smile:
  • One old, deleted token name=“Test” for the non working user, and the ZAPIER token :frowning:

SELECT * FROM company_tokens

id: 39
company_id: 11
account_id: 1
user_id: 1
token: “XYZ”
name: “Test”
created_at: “2021-12-07 15:56:59.465197”
updated_at: “2022-02-08 14:01:10.103759”
is_deleted: 1
is_system: 0

id: 40
company_id: 11
account_id: 1
user_id: 1
token: “XYZ”
name: “CreateClient_Zapi”
created_at: “2021-12-07 15:58:51.636529”
updated_at: “2022-02-08 14:01:10.103759”
is_deleted: 0
is_system: 0

id: 45
company_id: 11
account_id: 1
user_id: 2
token: “XYZ”
name: “Dart/2.18 (dart:io)”
created_at: “2024-01-04 16:54:58.131030”
updated_at: “2024-01-04 16:54:58.131030”
is_deleted: 0
is_system: 1

@david can you please advise?

deleting al the company_tokens helped… But I need to redo all the tokens for the external connections :frowning:

Apparently every login creates a new company_tokens entry. → Which is what is intended?
But as soon as such an entry exists, no other user can log in, because he encounters Server Error 500.

This means that I can only work with 1 user, which is very unfortunate… Unless I constantly delete the company_tokens entries…

I’m not sure, the only other case I can find of this the user made manual changes to their database.

@david may have some suggestions.