Terminal Uncontrolled Pagination Animation Causing UI Freeze
Bug Description The terminal was animating unpectedly, switching from terminal page to page , the same way codex does, but this time perpetually for along time. Unable to stop it other than to kill termial
Environment Info
- Platform: linux
- Terminal: vscode
- Version: 1.0.17
- Feedback ID: dd8c7486-f458-486f-aa8f-3d8d0e3ac127
Errors
[{"error":"Error: 1: ENOENT \n at NR6 (file:///home/james_karanja/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1358:4470)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async ER6 (file:///home/james_karanja/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1358:2566)","timestamp":"2025-06-07T06:44:07.401Z"}]
@Leon0412 thanks for raising this issue! 🙏🏼 The error seems to indicate the client id and secret are incorrect. Can you double check the google oauth2 settings are still set correctly?
@stnguyen90 Thank you for your answer. Yes, Google oAuth is configured correctly, also because createOAuth2Session works, but createOAuth2Token produces the errors mentioned. The user is also always created in the backend and also has the status “Verified email”
await account.createOAuth2Token(
provider: OAuthProvider.google,
);
produces the following errors in docker logs:
Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /usr/src/code/app/controllers/api/account.php on line 1426
[Error] Timestamp: 2025-06-13T09:06:36+00:00
[Error] Method: GET
[Error] URL: /v1/account
[Error] Type: Appwrite\Extend\Exception
[Error] Message: User (role: guests) missing scope (account)
[Error] File: /usr/src/code/app/controllers/shared/api.php
[Error] Line: 375
And
await account.createOAuth2Token(
provider: OAuthProvider.google,
success: 'appwrite-callback-[project-id]://[host]/v1/auth/oauth2/success/',
failure: 'appwrite-callback-[project-id]://[host]/v1/auth/oauth2/failure/',
);
produces only the following error in docker logs:
Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /usr/src/code/app/controllers/api/account.php on line 1426
Please let me know if I can provide any further information.
@Leon0412 thanks for checking.
Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /usr/src/code/app/controllers/api/account.php on line 1426
It looks like this warning is caused by:
https://github.com/appwrite/appwrite/blob/568f6fd2747dbb7adfcf846944e642830acf1617/app/controllers/api/account.php#L1426
and can be ignored.
Invalid OAuth2 Response. Key and Secret not available
This doesn't look like one of our error messages. Is that from your code?
[Error] Timestamp: 2025-06-13T09:06:36+00:00
[Error] Method: GET
[Error] URL: /v1/account
[Error] Type: Appwrite\Extend\Exception
[Error] Message: User (role: guests) missing scope (account)
[Error] File: /usr/src/code/app/controllers/shared/api.php
[Error] Line: 375
The account.createOAuth2Token() endpoint should not trigger the /v1/account error because the URL for account.createOAuth2Token() is /v1/account/tokens/oauth2/:provider:
https://github.com/appwrite/appwrite/blob/568f6fd2747dbb7adfcf846944e642830acf1617/app/controllers/api/account.php#L1759-L1767
Would you please look around to see if there's another error? It might also help to inspect the network logs client-side.
@stnguyen90 I think I have a solution to the problem.
I have checked the webAuth() method in your client_io.dart file:
...\appwrite-17.0.1\lib\src\client_io.dart:
This awaits key and secret. However, the URL contains only secret and userId - the key is not included here:
[...]
Uri url = Uri.parse(value);
final key = url.queryParameters['key'];
final secret = url.queryParameters['secret'];
if (key == null || secret == null) {
throw AppwriteException(
"Invalid OAuth2 Response. Key and Secret not available.",
500,
);
}
[...]
That's why I've rewritten your function locally:
@override
Future<Map<String, String>> webAuth(Uri url, {String? callbackUrlScheme}) async {
final result = await FlutterWebAuth2.authenticate(
url: url.toString(),
callbackUrlScheme: callbackUrlScheme != null && _customSchemeAllowed
? callbackUrlScheme
: "appwrite-callback-${config['project']!}",
options: const FlutterWebAuth2Options(
intentFlags: ephemeralIntentFlags,
useWebview: false,
),
);
final uri = Uri.parse(result);
final userId = uri.queryParameters['userId']; // instead of 'key'
final secret = uri.queryParameters['secret'];
if (userId == null || secret == null) {
throw AppwriteException(
"Invalid OAuth2 Response. User ID or Secret not available.",
500,
);
}
Cookie cookie = Cookie(userId, secret); // 'userId' instead of 'key'
cookie.domain = Uri.parse(_endPoint).host;
cookie.httpOnly = true;
cookie.path = '/';
List<Cookie> cookies = [cookie];
await init();
_cookieJar.saveFromResponse(Uri.parse(_endPoint), cookies);
return {'userId': userId, 'secret': secret};
}
Note that I have changed the method so that userId and secret are returned so that i can then easily execute account.createSession():
await account.createSession(
userId: result['userId'],
secret: result['secret'],
);
With these changes it now works for me. The user is created, the session is also created and the user can be successfully logged in.
Nevertheless, the success and failure parameters must still be specified in account.createOAuth2Token() so that the app opens again.
It works perfectly in the emulator. On a real device (in this case Samsung S23 Ultra), however, only a loading animation is displayed after selecting an account to log in. So the account selection is grayed out and the loading animation runs continuously. The app receives the data in the background, but is not opened. However, when I close the browser, I am logged in, but I have a solution here too:
To solve the problem, I have to remove the android:taskAffinity=“” in the AndroidManifest.xml. entry. Then it also works on the real physical device.
And I also looked again because of the error message, but it's not mine.
EDIT: The error message Invalid OAuth2 Response. Key and Secret not available comes from the above-mentioned file from your Flutter package. However, after the changes mentioned above, I no longer receive any error messages.
EDIT 2: Since this seems to be a bug in the flutter package, this is probably the wrong repository. Should I open a new issue in the Appwrite SDK for Flutter repository?
Let me know if I can do anything more or if you need more information.
This issue has been labeled as a 'question', indicating that it requires additional information from the requestor. It has been inactive for 7 days. If no further activity occurs, this issue will be closed in 14 days.
Since it is probably a bug in the Flutter package, I am closing the issue here for now and I have opened a new issue in the Appwrite SDK for Flutter repository.