-
I want to deploy my code on Docker over Lambda. I obtained this file from the documentation regarding PHP-FPM, but I want to use Octane as a handler. I have made some changes in my Dockerfile, replacing the public/index.php with the Octane handler. After deploying to Lambda, I am encountering this error:
FROM bref/php-81-fpm:2 COPY --from=bref/extra-redis-php-81:1 /opt /opt COPY . /var/task CMD ["public/index.php"]
FROM bref/php-82-fpm #COPY --from=bref/extra-redis-php-81:1 /opt /opt COPY . /var/task CMD ["Bref\LaravelBridge\Http\OctaneHandler"]
INIT_REPORT Init Duration: 24.44 ms Phase: init Status: error Error Type: Runtime.ExitError entrypoint requires the handler name to be the first argument |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
Hi, you need to switch to |
Beta Was this translation helpful? Give feedback.
-
"So, what should I do now? I am unable to run the Octane handler after trying all tweaks in the Dockerfile." |
Beta Was this translation helpful? Give feedback.
-
@mnapoli I'm running into the same issue with this Dockerfile on both ARM and x86: FROM bref/php-83:2
COPY . /var/task
CMD ["Bref\LaravelBridge\Http\OctaneHandler"] I also tried escaping the FROM bref/php-83:2
COPY . /var/task
CMD ["Bref\\LaravelBridge\\Http\\OctaneHandler"] I even tried referencing the handler directly, knowing it probably wouldn't work: FROM bref/php-83:2
COPY . /var/task
CMD ["vendor/bref/laravel-bridge/src/Http/OctaneHandler.php"] This might not be directly relevant to the Docker issue, but here's something related to Octane outside of Docker that might provide some insights for debugging: I've never managed to get the Octane handler to work with Bref v1 syntax when not using Docker. For example: functions:
web:
handler: Bref\LaravelBridge\Http\OctaneHandler
runtime: provided.al2
layers:
- ${bref:layer.php-83} This setup throws the error: "Handler However, this works fine: functions:
web:
handler: Bref\LaravelBridge\Http\OctaneHandler
runtime: php-83 Although these should be equivalent, they aren't, and I can't figure out why. I didn't report this before because the Bref v2 syntax works fine. Do you think these issues could be related? Any thoughts on what I might check next to troubleshoot the Docker problem? |
Beta Was this translation helpful? Give feedback.
-
I figured out a solution. I doubt it is the "correct" solution, but it works. Create a handler <?php
declare(strict_types=1);
use Bref\LaravelBridge\Http\OctaneHandler;
return new OctaneHandler(); Use that handler in your Dockerfile: FROM bref/php-83:2
COPY . /var/task
CMD ["octane.php"] |
Beta Was this translation helpful? Give feedback.
-
Hey everyone, I finally took some time to try and reproduce. After debugging, it turns out the CMD arguments must contain valid JSON (moby/moby#23670), so the So this works: CMD ["Bref\\LaravelBridge\\Http\\OctaneHandler"] I've opened #1821 to document that behavior explicitly. I'm going to close this as resolved, hopefully that should be the fix for everyone in this thread. |
Beta Was this translation helpful? Give feedback.
Hey everyone, I finally took some time to try and reproduce.
After debugging, it turns out the CMD arguments must contain valid JSON (moby/moby#23670), so the
\
must be escaped.So this works:
I've opened #1821 to document that behavior explicitly.
I'm going to close this as resolved, hopefully that should be the fix for everyone in this thread.