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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Invalid document structure: Missing required attribute "expire" on users.createSession() #8280

Closed
2 tasks done
oconr opened this issue Jun 17, 2024 · 2 comments 路 Fixed by #8308
Closed
2 tasks done
Assignees
Labels
bug Something isn't working product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.

Comments

@oconr
Copy link

oconr commented Jun 17, 2024

馃憻 Reproduction steps

This bug happens when I try to use createSession(userId) from the Node SDK, but it appears to also be happening in the PHP SDK when using $users->createSession($userId).

馃憤 Expected behavior

A session should be created for the user ID that is provided.

馃憥 Actual Behavior

The following errors gets thrown and logged

[Error] Timestamp: 2024-06-14T12:44:49+00:00
[Error] Method: POST
[Error] URL: /v1/users/:userId/sessions
[Error] Type: Utopia\Database\Exception\Structure
[Error] Message: Invalid document structure: Missing required attribute "expire"
[Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
[Error] Line: 3070

馃幉 Appwrite version

Version 1.5.x

馃捇 Operating system

Linux

馃П Your Environment

I have tried this on both Appwrite 1.5.4 and 1.5.7, both running on a DigitalOcean droplet. I'm using the latest version of the Node SDK

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@oconr oconr added the bug Something isn't working label Jun 17, 2024
@oconr
Copy link
Author

oconr commented Jun 17, 2024

@stnguyen90
Copy link
Contributor

ideclon's investigation:

My guess as to why this is happening - I see in POST /v1/account/sessions/token ($account->createSession()), expire is in the new Document() declaration:

'expire' => DateTime::addSeconds(new \DateTime(), $duration)

whereas in POST /v1/users/:userId/sessions ($users->createSession(), expire is added after the Document is created:
->setAttribute('expire', $expire)

@stnguyen90 stnguyen90 self-assigned this Jun 21, 2024
@stnguyen90 stnguyen90 added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label Jun 21, 2024
@stnguyen90 stnguyen90 linked a pull request Jun 21, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants