
Hi! In my SvelteKit project, I have the following appwrite.js
file:
import { Client, Databases, Account, Storage } from "appwrite";
const client = new Client();
client
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject("<my id>"); // Replace with your project ID
export const account = new Account(client);
export const databases = new Databases(client);
export const storage = new Storage(client);
then in +page.svelte
script i have (basically from tutorial):
import { storage } from "$lib/appwrite";
const upload = () => {
const promise = storage.createFile(
"files",
ID.unique(),
document.getElementById("uploader").files[0],
);
promise.then(
function (response) {
console.log(response); // Success
},
function (error) {
console.log(error); // Failure
},
);
};
But when i try to upload i get the following error: Uncaught ReferenceError: ID is not defined
. Any ideas why? Probably I did something stupid

Looks like you're not importing ID from anywhere so it's undefined.

import { ID } from "appwrite"
or import { ID } from "node-appwrite"

Thank you very much!

For some reason on the wbsite the ID isn't imported anywhere

[SOLVED] Uncaught ReferenceError: ID is not defined
Recommended threads
- I have an error oauth with Microsoft
invalid_request: The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for...
- how many Teams can be created?
I am creating an app where I will let users create groups. This could mean there will be many groups created by user, to isolate those groups properly I am thin...
- React native app login via Safari
Hi! I deployed for debug my React Native app in web, chrome everythink works well but in safari on mac and ios I cant login. I found this one error in safari co...
