API Gateway to both a global handler and a global s3 static website (with route 53)

I’m trying to get a simple architecture working:

request: https://ndd.tld/api/anything
=> Route 53
=> API Gateway
=> Lambda proxy, one function to manage the entire micro api

request : https://ndd.tld/anything-else
=> Route 53
=> API Gateway
=> S3 bucket (if 404, the index.html, else, the file just found)

The lambda part is working fine, but not the static files. I have this serverless.yml:

service: my-service
provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: eu-west-3

custom:
  serverless-offline:
    port: 3030
    printOutput: true
  apiGatewayServiceProxies:
    - s3:
      path: /s3/{folder}/{file}
      method: get
      action: GetObject
      bucket:
        Ref: S3Bucket
      cors: true

resources:
  Resources:
    S3Bucket:
      Type: 'AWS::S3::Bucket'

functions:
  api-handler:
    handler: api/index.handler
    events:
      - http:
          path: api/{proxy+}
          method: ANY
          cors: true

plugins:
  - serverless-dotenv-plugin
  - serverless-plugin-typescript
  - serverless-apigateway-service-proxy
  - serverless-offline

I get this error child "s3" fails because ["s3" must be an object]

You appear to have left out Properties -> BucketName in your S3 resource definition, unless I’m very much mistaken

I agree, but from the documentation (https://github.com/horike37/serverless-apigateway-service-proxy#s3) I fail to see where I should put this

Oh, the “s3 must be an object” error is just about the yml being not valid (indentation issue, I like json more). SHAME SHAME SHAME.

For the bucket name, you mean something like this :

resources:
  Resources:
    S3Bucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: __my-bucket-name___

That’s the one, yes.