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

📚 Documentation: missing setSelfSigned on js client #60

Closed
2 tasks done
PaulDotterer opened this issue Jun 30, 2023 · 4 comments
Closed
2 tasks done

📚 Documentation: missing setSelfSigned on js client #60

PaulDotterer opened this issue Jun 30, 2023 · 4 comments
Assignees

Comments

@PaulDotterer
Copy link

PaulDotterer commented Jun 30, 2023

💭 Description

Thanks for Taking your time.

Im currently struggling to get the Appwrite web SDK to connect to my locally hosted Appwirte instance.

I spun up AppWrite inside Docker, and setup a new project "testing". When i try to sign in a user via the SKD, i get "404 | ERR_CERT_AUTHORITY_INVALID"
When i try to set "setSelfSigned()" on the client i get the error "client.setEndpoint(...).setProject(...).setSelfSigned is not a function".

Here is my AppwriteService.js file:

import { Account, Avatars, Client, Teams, Storage, Databases, Functions } from 'appwrite';
  
  export const AppwriteEndpoint = "https://localhost/v1";
  export const AppwriteProject = "testing";
  
  const client = new Client().setEndpoint(AppwriteEndpoint).setProject(AppwriteProject).setSelfSigned();
  const account = new Account(client);
  const avatars = new Avatars(client);
  const teams = new Teams(client);
  const storage = new Storage(client);
  const databases = new Databases(client);
  const functions = new Functions(client);
  
  export const AppwriteService = {
	  signOut: async () => {
		  await account.deleteSession('current');
	  },
	  signIn: async (email, password) => {
		  await account.createEmailSession(email, password);
	  },
	  setSession: (hash) => {
		  const authCookies = {};
		  authCookies['a_session_' + AppwriteProject] = hash;
		  client.headers['X-Fallback-Cookies'] = JSON.stringify(authCookies);
	  }
  };

I cant find any documentation on how to get this working. With the node-appwrite package it works like expected, but in the web SDK i cant get it working.

Im using SvelteKit 1.21.0
AppWrite Web SDK version 11.0.0

👀 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?

@PaulDotterer PaulDotterer changed the title 📚 Documentation: 📚 Documentation: missing setSelfSigned on js client Jun 30, 2023
@joeyouss joeyouss self-assigned this Jul 3, 2023
@AttiZK
Copy link

AttiZK commented Jul 14, 2023

Same issue for me. I'm basically trying to initialize appwrite in localhost like so:

import { Client, Account } from 'appwrite';

const client = new Client();
client.setEndpoint('https://localhost:3001/v1')
.setProject('xxxxxxx')
.setSelfSigned();

just like the documentation says:
https://appwrite.io/docs/certificates

I'm running a next.js build and installed the latest appwrite with docker. But I'm keep getting the error:
".setSelfSigned is not a function"
Tried installing openssl certificate too, tried re-installing and getting the latest appwrite (v.1.3.7). What else can I try? Or should I just forget about this working on a localhost? Any workarounds?

@PaulDotterer
Copy link
Author

Same issue for me. I'm basically trying to initialize appwrite in localhost like so:


import { Client, Account } from 'appwrite';



const client = new Client();

client.setEndpoint('https://localhost:3001/v1')

.setProject('xxxxxxx')

.setSelfSigned();



just like the documentation says:

https://appwrite.io/docs/certificates

I'm running a next.js build and installed the latest appwrite with docker. But I'm keep getting the error:

".setSelfSigned is not a function"

Tried installing openssl certificate too, tried re-installing and getting the latest appwrite (v.1.3.7). What else can I try? Or should I just forget about this working on a localhost? Any workarounds?

@AttiZK As far as i can tell, the source code does not exist in the SDK to set this flag. I found a workaround tho. You can navigate in you browser to “https://localhost” and accept the certificate error and then you you will be able to make client calls. It will only work in the browser you accepted the certificate since this action is scoped to the browser,
Not the system. After every appwrite restart you need to redo this.

@AttiZK
Copy link

AttiZK commented Jul 15, 2023

Well, that's something I can work with for now, thanks!

@gewenyu99
Copy link

gewenyu99 commented Jul 18, 2023

The response above is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants