Back

Error 401 (Unauthorized) on Oracle Free Tier

  • 0
  • Self Hosted
  • Web
Łukasz
19 Sep, 2023, 17:51

I own two VPS. On both I have the same system (Ubuntu) installed in the same version. I have installed Appwrite on both of them. I connect to the first one without any problem through the SDK for JavaScript. For the second one (Oracle Free Tier) I get a 401 (Unauthorized) error message. From the firewall in the Oracle management panel I have ports 80 and 443 added.

I am guessing that something might be wrong with the configuration of Oracle VPS (Oracle Free Tier).

Additionally:

  • Both have a domain with a working certificate. I have access to the Appwrite admin panel
  • I have two projects on the Oracle VPS: The first is a clean new project, the second is a migrated project from first VPS (both projects with a 401 error)
TL;DR
User is experiencing an Error 401 (Unauthorized) on Oracle Free Tier with their Appwrite instances. They are unsure if the problem is with the source or target instance and are seeking guidance on how to resolve it. They also ask for a proven way to backup and restore their Appwrite data. The user later discovers that the password for the migrated project had changed during the migration and resolves the issue by resetting the password. The user also mentions encountering an AppwriteException regarding missing scope (account) and provides screenshots of the errors. They speculate that the issue may be related to the configuration of the Oracle VPS.
Drake
19 Sep, 2023, 20:03

Would you please provide more detail and context on the error? What are you doing that's causing the error? What's the full error message?

Łukasz
19 Sep, 2023, 20:13

The error appears every time you try to connect to Endpoint. When retrieving logged-in account data (GET), when trying to log in (POST).

I will add that I have a copy of the entire project on the other VPS and as soon as I set the endpoint to this VPS in the js file, everything works. I checked the settings of both projects in the Appwrite panel and they are identical.

I am sending a screenshot of the errors. The first one (GET) is called by: await account.get();

The second when trying to log in: await account.createEmailSession(email, password);

Also appears: AppwriteException: User (role: guests) missing scope (account) (also visible on screenshot)

Drake
19 Sep, 2023, 20:29

so account.get() is failing because you're not logged in...and what's the response body for the account.createEmailSession()?

Łukasz
19 Sep, 2023, 21:05

Invalid credentials.

Problem solved. For some reason, the user's password changed during the project migration. After resetting it from the Appwrite panel, everything works. Thank you for guiding me to the solution.

Drake
19 Sep, 2023, 21:06

Fyi, passwords are encrypted using the openssl environment variable. If it's different between the environments, Appwrite won't be able to decrypt the password

Drake
19 Sep, 2023, 21:06

I'm also assuming you manually inserted the SQL data into the new instance

Łukasz
19 Sep, 2023, 21:11

variable _APP_OPENSSL_KEY_V1 is the same. Project was migrated using build-in migration tool in Appwrite 1.4.X

Łukasz
19 Sep, 2023, 21:14

Check other account on both Appwrite instances. On the first password works, but on the second (migrated project) password doesn't work.

Łukasz
19 Sep, 2023, 21:28

I deleted the entire project. I created new. I did the migration with the built-in tool once again. I double-checked that the _APP_OPENSSL_KEY_V1 variable is the same in both instances and the effect is the same. The password works on the original instance, but still doesn't work on the new one (migrated). I checked several accounts.

Łukasz
19 Sep, 2023, 21:30

First Instance Appwrite Version: 1.4.1 Second: 1.4.3 Maybe that's the problem?

D5
19 Sep, 2023, 21:30

Maybe

Łukasz
19 Sep, 2023, 21:33

Can I ask for some proven way to backup and restore Appwrite. Tomorrow I will try to upgrade from 1.4.1 -> 1.4.3, but I have an important project there and I need to be sure that the data is safe.

Drake
19 Sep, 2023, 21:45

https://youtu.be/lM5yZEPtlvg?feature=shared

Make sure to test your backup

Drake
21 Sep, 2023, 19:40

Ya, I think there's a bug with the passwords. I've created an issue here: https://github.com/appwrite/appwrite/issues/6303

Łukasz
21 Sep, 2023, 20:43

I understand, so I will wait for the fix.

Question: is the problem in the source instance from which the project migrates? Or on the side of the target instance. This is important to me because it is safer for me to update only the target Appwrite instance.

Drake
21 Sep, 2023, 20:45

Target

Drake
21 Sep, 2023, 20:45

You can also migrate your users yourself by using the server sdk

Łukasz
21 Sep, 2023, 20:47

This is good info for me.

Łukasz
21 Sep, 2023, 20:48

Sounds interesting. I can wait for a fix, but I'd love to know how to do it.

Łukasz
21 Sep, 2023, 20:59

Thanks

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more