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
- 408 Timeout / Curl Error 7 in Executor w...
Hey everyone, I am losing my mind over a routing loop/timeout issue on a fresh self-hosted setup. I have a single Linux VPS (IP: 45.141.37.105) and one domain (...
- functions returning error 401 in local
I updated to 1.9.0, and the functions that used to work fine in 1.8.1 are now giving me a 401 error. I can't seem to find a solution. If anyone is running versi...
- Docker Compose MongoDB Setup
everythings work fine but the mongodb fails on startup everytime. log: ``` Generating random MongoDB keyfile... /bin/bash: line 9: : No such file or directory ...