Hi, I seem to be running an issue with my UploadFile Script.
It doesnt seem to give an error code back i can actually do something with:
at _Client.call (webpack-internal:///(action-browser)/./node_modules/node-appwrite/dist/client.js:275:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async _Client.chunkedUpload (webpack-internal:///(action-browser)/./node_modules/node-appwrite/dist/client.js:220:14)
at async Storage.createFile (webpack-internal:///(action-browser)/./node_modules/node-appwrite/dist/services/storage.js:303:12) {
code: 500,
type: 'general_unknown',
response: {
message: 'Server Error',
code: 500,
type: 'general_unknown',
version: '1.5.1'
}
}```
Code where it goes wrong:
```jsx
export async function UploadFile(file) {
const File = file.get("file");
const client = await createAdminClient();
const storage = new Storage(client);
const fileExists = await CheckIfFileExists(File.name);
if (!fileExists) {
const uploadResponse = storage.createFile(
process.env.NEXT_PUBLIC_BUCKET_ID,
ID.unique(),
File
);
return uploadResponse.$id;
} else {
const files = await storage.listFiles(process.env.NEXT_PUBLIC_BUCKET_ID);
const existingFile = files.files.find((files) => files.name === File.name);
return existingFile.$id;
}
}
checked all keys and ID's so that shouldnt be the issue
Run docker logs appwrite
after you're uploading the file for getting the error
Yes i check it out and i get this:
[Error] Timestamp: 2024-05-30T18:38:27+00:00
[Error] Method: POST
[Error] URL: /v1/storage/buckets/:bucketId/files
[Error] Type: RuntimeException
[Error] Message: Unable to connect to ClamAV server
[Error] File: /usr/src/code/vendor/appwrite/php-clamav/src/ClamAV/Network.php
[Error] Line: 66
I dont remember using ClamAV but it might be an internal package?
You should disable anti-virus in your bucket settings
Or Enable it in the docker compose
alright. thanks
# clamav:
# image: appwrite/clamav:1.2.0
# container_name: appwrite-clamav
# restart: unless-stopped
# networks:
# - appwrite
# volumes:
# - appwrite-uploads:/storage/uploads
These commented lines, I'm not sure if it works out-of-the-box though.
ill check ill get back to this. Trying rn
that would be a no services.redis Additional property clamav is not allowed
let me if i can find anytrhing it in the docs
You should make sure the indented are different So the final results should be like so
redis:
image: redis:7.2.4-alpine
container_name: appwrite-redis
<<: *x-logging
restart: unless-stopped
command: >
redis-server
--maxmemory 512mb
--maxmemory-policy allkeys-lru
--maxmemory-samples 5
networks:
- appwrite
volumes:
- appwrite-redis:/data:rw
clamav:
image: appwrite/clamav:1.2.0
container_name: appwrite-clamav
restart: unless-stopped
networks:
- appwrite
volumes:
- appwrite-uploads:/storage/uploads
I removed only 1 indent. Turns out i need 2. Checking if it works with the antivirus on
ah well i know where the issue is coming from. So i consider this solved for now. ClamAV seems to be throwing a tantrum though so no antivirus
[SOLVED] Server Error
Recommended threads
- Realtime with multiple connections
I need the Realtime on multiple Collections for diffrent applicational logic. So my question is: Is there a way to have only 1 Websocket connection or do I need...
- Can't login or deploy functions in Appwr...
Hello, since i updatet to the appwrite cli 6.1.0 i can't login or deploy functions with the cli. When i call the command: "appwrite get account --verbose" i ge...
- Create admin user?
I'm not really sure how this is supposed to work, I installed Appwrite through docker-compose and set it up. When I launched the app and went into it, I created...