Closed cnkmmk closed 2 years ago
This looks like something in your installation has been mixed up rather than a bug in Lychee. Please
git status
inside your installation directory to ensure that the working dir is clear and spurious outdated files are left./artisan config:clear
(./artisan list
should give you a list of all commands and then watch out for 'clean
or clear
)public/
. We have seen this kind of error once or twice from users who moved the frontend to some other location, configured the webserver to serve the frontend from that alternative location and then forgot to update that copy of the frontend when the updated the backend.I unzip version 4.5.3 files in new directory, copy all upload files and database file. run 'php artisan migrate'. I can view Lychee in browser.
I run 'php artisan optimize:clear' the same error.
BTW, please use the template to report errors. In particular, the output of the diagnostic and the information about your system is missing.
Just to confirm, php artisan migrate
worked fine, and viewing existing photos works fine as well?
I was going to suggest that you check the versions of your PHP engine and the database engine, but if the migration worked, then you are probably fine on that front...
I still believe the issue is an out-of-sync error between a newer version of the backend and an older version of the frontend. The error basically tells us that the frontend sends a non-JSON request when the backend expects one.
In the past versions (i.e. before my refactorings) many requests related to "read access" (i.e. viewing photos, browsing albums, etc.) were already properly formatted JSON requests. Much of the refactoring went into requests related to uploading photos and error reporting. If the version of the frontend was too old for the backend, this could also explain why simple browsing just seems to work fine, while uploading does not.
Anyway, without having a proper diagnostic output, this is like tapping around in the dark.
FYI, the compiled front end files reside in public/dist/
. So, @cnkmmk, please verify that, e.g., public/dist/main.js
in your installation is 966932
bytes long...
thank you. @kamil4
My system infomation
{
order webdav before file_server
auto_https off
}
(global) {
php_fastcgi unix//run/php/php8.1-fpm.sock
file_server
log {
output file /var/log/caddy/caddy.log
format filter {
wrap json {
time_format wall
}
fields {
request>headers>Accept delete
request>headers>Accept-Language delete
request>headers>Connection delete
request>headers>Cookie delete
request>headers>Accept-Encoding delete
request>headers>Upgrade-Insecure-Requests delete
request>headers>X-Xsrf-Token delete
request>headers>Sec-Fetch-Dest delete
request>headers>Sec-Fetch-Site delete
request>headers>Sec-Fetch-Mode delete
request>headers>Sec-Fetch-User delete
request>headers>X-Requested-With delete
request>headers>Content-Length delete
request>headers>Te delete
request>headers>Content-Type delete
request>proto delete
request>method delete
request>remote_port delete
request>tls delete
user_id delete
duration delete
resp_headers delete
}
}
}
}
:2280 {
root * /opt/www/
redir /webdav /webdav/
handle /webdav/* {
basicauth /webdav/* {
mercuryhg JDJhJDEwJEphdUZRUjNUYmY4QTNqMDNjV1I0NXU1TU1rNVkwUEZ4YU1PMTh2aFVuNXJCalltQ2VHcDI2
}
webdav /webdav/* {
root /opt/webdav/
prefix /webdav/
}
}
import global
tls "/opt/lets/fullchain.cer" "/opt/lets/*.*****.win.key"
}
:2281 {
root * /opt/Lychee/public/
import global
tls "/opt/lets/fullchain.cer" "/opt/lets/*.*****.win.key"
}
:2282 {
root * /opt/baikal/html/
import global
tls "/opt/lets/fullchain.cer" "/opt/lets/*.*****.win.key"
}
:2283 {
root * /opt/xiaoshuo/
import global
@te {
not remote_ip 192.168.4.244 192.168.4.23
}
handle @te {
respond "Access denied" 403
}
}
install packets
apt install -y libpcre2-dev php8.1-cgi php8.1-fpm php8.1-curl php8.1-gd php8.1-xml php8.1-mbstring php8.1-zip php8.1-mysql php8.1-sqlite3 php8.1-bcmath php8.1-gd php8.1-imagick
upgrade step:
max_execution_time = 200
post_max_size = 100M
upload_max_size = 100M
upload_max_filesize = 100M
memory_limit = 256M
wrap json { time_format wall } fields { request>headers>Accept delete request>headers>Accept-Language delete request>headers>Connection delete request>headers>Cookie delete request>headers>Accept-Encoding delete request>headers>Upgrade-Insecure-Requests delete request>headers>X-Xsrf-Token delete request>headers>Sec-Fetch-Dest delete request>headers>Sec-Fetch-Site delete request>headers>Sec-Fetch-Mode delete request>headers>Sec-Fetch-User delete request>headers>X-Requested-With delete request>headers>Content-Length delete request>headers>Te delete request>headers>Content-Type delete request>proto delete request>method delete request>remote_port delete request>tls delete user_id delete duration delete resp_headers delete }
I don't have time to look properly right now, but these look suspect to me...
If I interpret this Nginx config correctly, this only affects the content of the log. So it should not be the reason.
But you are running PHP FPM. Please try to restart the FPM daemon, i.e. depending on your system it is something like systemctl restart php-fpm-8.0
.
FPM caches pre-compiled PHP code and depending on your FPM settings it may or may not invalidate the cache upon changing the original PHP files.
If I interpret this Nginx config
Caddy, not nginx, but yes it looks like you're right about it referring to the logs.
Sorry, everyone, I make a mistake. I can not change the php.ini. when changed, I can upload.
I upgrade Lychee to 4.5.3. can not uploads image.
log
2022-08-18 05:27:08 UTC -- error -- App\Http\Middleware\AcceptContentType::handle -- 41 -- Content type unacceptable. Content type "json" required 2022-08-18 05:26:39 UTC -- error -- Illuminate\Foundation\Http\FormRequest::failedValidation -- 138 -- The given data was invalid. 2022-08-18 05:26:39 UTC -- error -- App\Http\Requests\BaseApiRequest::validateResolved -- 84 -- The given data was invalid.; caused by 2022-08-18 05:25:20 UTC -- error -- Illuminate\Foundation\Http\FormRequest::failedValidation -- 138 -- The given data was invalid. 2022-08-18 05:25:20 UTC -- error -- App\Http\Requests\BaseApiRequest::validateResolved -- 84 -- The given data was invalid.; caused by
php artisan lychee:diagnostics
In Builder.php line 2678:
Undefined property: stdClass::$owner_id