#Network request failed: net::ERR_CERT_AUTHORITY_INVALID

2 messages · Page 1 of 1 (latest)

hot lily
#

Hello all, I am completely new to Appwrite and have just spun up my first instance via Docker as per the "Getting Started" guide:

docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:1.2.1

I am on a Mac with M1 chip running macOS Ventura 13.2.1. I accepted all of the default settings using Ports 80 and 443 and am running on localhost.

I have Appwrite running on http://localhost:80 and have signed up and created my first App using the 'Web' preset.

I have made a next.js app where I am attempting to create a User via the Accounts API linked to my AppWrite App.

I have created a client and account instance using my project ID:

// located in libs/appwrite/appwriteConfig.ts file 
import { Client, Account } from 'appwrite'

const client = new Client()
  .setEndpoint('https://localhost/v1') // Your API Endpoint
  .setProject('64188acd7499dca23b77')  // Your project ID

export const account = new Account(client);

I import and use this when my signup form is submitted:

import { ID } from 'appwrite'
import { account } from '../../../../libs/appwrite/appwriteConfig'

const signupUser = async (e) => {
    e.preventDefault()

    const promise =  account.create(
      ID.unique(),
      user.email,
      user.password
    );

    promise.then(
      function(response ) {
        console.log(response)
      },
      function(error) {
        console.log(error)
      }
    )
  }

I am providing the required ID, email and password parameters in my POST request to https://localhost/v1/account

But I am receiving the following error message.

POST https://localhost/v1/account net::ERR_CERT_AUTHORITY_INVALID

My Next.js app is running on http://localhost:4200. I have clearly missed something but can't find what it is via the Appwrite docs.

Any guidance would be greatly appreciated.

#

Having wracked my head over this last night, I walked away, got some sleep and then realised the solution to my issue.

In my Appwrite client I had incorrectly referenced https://localhost/v1 rather than http://localhost/v1

Corrected code is now:

import { Client, Account } from 'appwrite'

const client = new Client()
  .setEndpoint('http://localhost/v1') // Your API Endpoint
  .setProject('64188acd7499dca23b77')  // Your project ID



export const account = new Account(client);

My silly mistake.