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

databases.php collection not found #7341

Merged
merged 33 commits into from
Apr 29, 2024
Merged

Conversation

fogelito
Copy link
Contributor

@fogelito fogelito commented Dec 27, 2023

Fix Collection not found 500
In the Error I saw the projectId = "console". so perhaps we can disable console project in the API?

Fixes: #6166

@eldadfux eldadfux added the product / databases Fixes and upgrades for the Appwrite Database. label Feb 18, 2024
@fogelito fogelito requested a review from abnegate April 9, 2024 15:00
@fogelito fogelito mentioned this pull request Apr 11, 2024
2 tasks
->inject('project')
->action(function (Document $project) {
if ($project->getId() === 'console') {
throw new Exception(Exception::PROJECT_RESERVED_PROJECT, 'Please check X-Appwrite-Project header');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error is not good enough. It assumes the consumer context is the API but ignores SDKs or console where the consumer has no idea what this error is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gewenyu99 Any input for a message here? This is the case when the project is set as console, and you're calling an unsupported API like databases, functions etc.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questions here:

  1. Can I name my project ID console? We shouldn't allow this during creation.
  2. Could this ever display on the console?

Either way:
[What went wrong][why we think it went wrong][steps to debug/fix]
We can try:
This endpoint is not available for the console project. The Appwrite Console is a reserved project ID and cannot be used with the Appwrite SDKs and APIs. Please check if your project ID is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gewenyu99

  1. You can not name a project ID console, it's disallowed during creation.
  2. This happens in 99% when a user does not assign the X-Appwrite-Project header , We are the ones who fallback to console project

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fogelito We should throw a separate error for when project ID is not assigned. Is that possible?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If console:
This endpoint is not available for the console project. The Appwrite Console is a reserved project ID and cannot be used with the Appwrite SDKs and APIs. Please check if your project ID is correct.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abnegate Sound good?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. @eldadfux?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The console project is something internal, a normal dev using Appwrite has no idea what it is and its very confusing.
  2. We shouldn't mention x-appwrite-project just like that, this header is only visible to REST users, which are minority if we do mention the context should be clear and the first thing mention should be setting the project ID. We can also skip the header name altogether.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. @eldadfux We have two errors now. IF they get an error that mentions console, they have it set as their project. IMO this is fine.

  2. We can do: No Appwrite project was specified. Please specify your Appwrite Project ID on your Appwrite SDK Client.

app/controllers/general.php Outdated Show resolved Hide resolved
@eldadfux
Copy link
Member

Also, are we getting console project ID by default even if no project ID was set? Where is this happening? what happens if the header value is empty or not provided at all?

@abnegate
Copy link
Contributor

abnegate commented Apr 15, 2024

Also, are we getting console project ID by default even if no project ID was set? Where is this happening? what happens if the header value is empty or not provided at all?

@eldadfux Yep we are defaulting to console here: https://github.com/appwrite/appwrite/blob/main/app/init.php#L1233-L1235

@fogelito fogelito requested a review from gewenyu99 April 16, 2024 07:46
@abnegate abnegate requested a review from eldadfux April 18, 2024 07:26
composer.lock Outdated Show resolved Hide resolved
@abnegate abnegate changed the base branch from main to refactor-usage-sn April 29, 2024 09:03
@abnegate abnegate merged commit aeea5e8 into refactor-usage-sn Apr 29, 2024
21 checks passed
@abnegate abnegate deleted the collection-not-found branch April 29, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product / databases Fixes and upgrades for the Appwrite Database.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Clarify error message when project ID is missing
4 participants