Enigmatic-Smile / serverless-plugin-optimize

⛔️ DEPRECATED ⛔️ Bundle with Browserify, transpile and minify with Babel automatically to your NodeJS runtime compatible JavaScript
https://www.npmjs.com/package/serverless-plugin-optimize
MIT License
130 stars 54 forks source link

Handler path not being rewritten #60

Closed rodrigoreis22 closed 5 years ago

rodrigoreis22 commented 6 years ago

The handler path when I look inside the aws console is wrong: handler.app (https://d.pr/i/1lwDqI)

I needs to be _optimize/arena-node-api-dev-app/handler.app for it to work.

I have debug: true and this is my output:

Rodrigos-MacBook-Pro:arena-node-api rodrigoreis$ sls1 deploy -f app
Serverless: Optimize: starting engines
Serverless: Optimize: arena-node-api-dev-app
Serverless: Packaging function: app...
Serverless: Excluding development dependencies...
Serverless: Optimize: debug {
  "functions": [
    {
      "bundle": "/Users/rodrigoreis/Documents/arena-api/arena-node-api/_optimize/arena-node-api-dev-app/handler.js",
      "handlerOriginal": "handler.app",
      "handlerOptimize": "_optimize/arena-node-api-dev-app/handler.app",
      "package": {
        "exclude": [
          "**"
        ],
        "include": [
          "_optimize/arena-node-api-dev-app/**"
        ]
      }
    }
  ],
  "options": {
    "debug": true,
    "exclude": [
      "aws-sdk"
    ],
    "external": [
      "mongoose"
    ],
    "externalPaths": {},
    "extensions": [],
    "global": false,
    "includePaths": [],
    "ignore": [],
    "minify": true,
    "plugins": [],
    "prefix": "_optimize",
    "presets": [
      [
        "/Users/rodrigoreis/Documents/arena-api/arena-node-api/node_modules/babel-preset-env/lib/index.js",
        {
          "targets": {
            "node": "8.10"
          }
        }
      ]
    ],
    "individually": true
  }
}

This is my serverless.yml:

service: arena-node-api

# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"

custom:
  stage: "${opt:stage, self:provider.stage}"
  optimize:
    debug: true
    external: ['mongoose']

provider:
  name: aws
  stage: dev
  runtime: nodejs8.10
  profile: default
  region: us-west-2
  memorySize: 256
  vpc:
    securityGroupIds:
      - sg-7268ed14
    subnetIds:
      - subnet-28db1d70
      - subnet-44369a0f
      - subnet-f411938d
  environment:
      env: ${self:custom.stage}

# you can add packaging information here
package:
  individually: true

functions:
  app:
    handler: handler.app
    events:
      - http: ANY /
      - http: 'ANY {proxy+}'
    vpc:
      securityGroupIds:
        - sg-7268ed14
      subnetIds:
        - subnet-28db1d70
        - subnet-44369a0f
        - subnet-f411938d
  billing:
      handler: handler.billing
      events:
        - http:
            path: billing
            method: ANY
            cors:
              origin: '*'
              headers:
                - Content-Type
                - X-Amz-Date
                - Authorization
                - X-Api-Key
                - X-Amz-Security-Token
                - X-Amz-User-Agent
                - Preferred-Language
        - http:
            path: billing/{proxy+}
            method: ANY
            cors:
              origin: '*'
              headers:
                - Content-Type
                - X-Amz-Date
                - Authorization
                - X-Api-Key
                - X-Amz-Security-Token
                - X-Amz-User-Agent
                - Preferred-Language
      vpc:
        securityGroupIds:
          - sg-7268ed14
        subnetIds:
          - subnet-28db1d70
          - subnet-44369a0f
          - subnet-f411938d
  live-score-update:
    handler: handler_live_score_update.handler

plugins:
  - serverless-plugin-optimize
goncaloneves commented 6 years ago

Did you come to a solution? What version of SLS are you using?

rodrigoreis22 commented 5 years ago

Hi @goncaloneves , it just started working again without touching anything. When I had this problem I changed the path manually on aws console to _optimize/arena-node-api-dev-app/handler.app .

goncaloneves commented 5 years ago

Great to know. Closing.