php - 无服务器框架,处理程序不存在

我正在使用无服务器框架在 AWS Lambda 上部署我的 PHP 函数。 我试过一个简单的例子,但我可以在 cloudwatch 中看到这个错误:

Handler `/var/task/public/test.hello` doesn't exist

这是我的无服务器文件:

service: symfony-bref

provider:
    name: aws
    region: eu-central-1
    runtime: provided
    environment:
        APP_ENV: prod

plugins:
    - ./vendor/bref/bref

functions:
    api:
        handler: public/index.php
        description: ''
        timeout: 30 # in seconds (API Gateway has a timeout of 30 seconds)
        layers:
            - ${bref:layer.php-73-fpm}
        events:
            -   http: 'ANY /'
            -   http: 'ANY /{proxy+}'

    S3Handler:
        handler: public/test.hello
        layers:
            - ${bref:layer.php-73}
        events:
            - s3:
                bucket: ${ssm:/symfony-bref/AWS_S3_BUCKET_NAME:1}
                event: s3:ObjectCreated:*
                existing: true

我的函数 test.php 位于 public 文件夹中:

<?php


function hello($eventData) : array
{
    return ["msg" => "hello from PHP " . PHP_VERSION];
}

我可以为功能 S3Handler 做什么? Api 功能正常。

最佳答案

我看到您在 serverless.yml 文件中添加了处理程序作为 handler: public/index.php,但您的文件名为 test.php。在我看来,这像是打字错误。

https://stackoverflow.com/questions/60276092/

相关文章:

pytorch - 在 Pytorch tensorboard 中绘制几张图

node.js - 谷歌 API + Passport + react : Authenticati

azure-devops - 在 Azure Devops 中编写 EF6 迁移脚本

css - 使用 attr() 更新 CSS 变量

python - 如何在 TensorFlow 2 中保存/加载模型的一部分?

django - 使用 DjangoFilterConnectionField 时有没有办法删除边和

android - 蓝牙扫描设备,频繁扫描后无法写入设备

ruby - RSpec Mock - 类未实现实例方法 : jql. 也许您打算改用 `class

java - 如何将不同大小的元素立即放在彼此之上?

javascript - Vue.js 清除用户缓存