Hi
I am trying to deploy Koolreport to Laravel Vapor. This is an implementation of Laravel hosted in a serverless environment using AWS Lambda.
At first, when I tried running a report I got ErrorException: Undefined index: SCRIPT_NAME
at /vendor/koolreport/core/src/core/Utility.php line 491. The reason was that there was no $_SERVER['SCRIPT_NAME']
variable defined in the environment. As a workaraound, I am running the following code prior to running the report (I might consider raising a PR for this):
if (!array_key_exists("SCRIPT_NAME", $_SERVER)) {
$scriptFilename = str_replace("\\","/",$_SERVER["SCRIPT_FILENAME"]);
// Read script_filename backwards until we reach /
for ($i=strlen($scriptFilename)-1; $scriptFilename[$i]!="/" && $i>0 ; $i--) {
}
$_SERVER["SCRIPT_NAME"] = substr($scriptFilename, $i);
}
Having resolved that issue, I am now getting copy(/var/task/public/koolreport_assets/3157288213/KoolReport.js): failed to open stream: No such file or directory (View: /var/task/resources/views/reports/report.blade.php)
at /vendor/koolreport/core/src/core/Utility.php line 92. This line is part of the Utility::recurseCopy()
method and reads:
Utility::recurseCopy($src . '/' . $file, $dst . '/' . $file);
The context is
{
dir: Resource stream,
dst: /var/task/public/koolreport_assets/3157288213,
file: KoolReport.js,
src: /var/task/vendor/koolreport/core/src/clients/core
}
Further investigation reveals that the folder /var/task/public/koolreport_assets/3157288213
doesn't exist, though it's parent (koolreport_assets
) does (at, at the time of debugging, so was koolreport_assets/3460555030
.
Is there anything that I can do prior to running the report (or ideally at deployment time) to prevent this copy from occurring? And where does the folder name 3157288213 come from?
Finally, are there any other known issues deploying to Laravel Vapor that I would need to be aware of?
Many thanks Nick