AnomalyInnovations / serverless-bundle

Optimized packages for ES6 and TypeScript Node.js Lambda functions without any configuration.
https://serverless-stack.com/chapters/package-lambdas-with-serverless-bundle.html
MIT License
535 stars 157 forks source link

Webpack update changes only after a long time #349

Open IgorAlexeew opened 1 year ago

IgorAlexeew commented 1 year ago

After the changes in the code, the following is output

Issues checking in progress...
No issues found.

But at the same time, there is no change in the lambdas, they are executed in the old way. And they are updated only after 5-10 minutes

service: peeranha-api

custom:
  stage: ${opt:stage, 'offline'}
  region: ${file(./stages/${self:custom.stage}.yml):region}
  bundle:
    linting: false
    forceExclude: electron
  serverless-offline:
    httpPort: 4000
    noPrependStageInUrl: true
    ignoreJWTSignature: true
  serverless-offline-sns:
    port: 4002
    debug: true
    accountId: 123456789012
  s3:
    host: localhost
    directory: ./s3-local
  dynamodb:
    stages:
      - offline
    start:
      port: 4659
      inMemory: true
      migrate: true

provider:
  name: aws
  region: ${file(./stages/${self:custom.stage}.yml):region}
  runtime: nodejs16.x
  environment: ${file(./stages/${self:custom.stage}.yml):environment}
  memorySize: 512
  timeout: 10
  logRetentionInDays: 90
  lambdaHashingVersion: 20201221 # https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
  logs:
    httpApi: true
  httpApi:
    # metrics: true # Enable if you need
    cors: true
    authorizers:
      auth-user:
        type: request
        resultTtlInSeconds: 0
        functionName: auth-user
        identitySource: ["$request.header.Authorization"]
  iam:
    role:
      statements:
        - Effect: Allow
          Action:
            - secretsmanager:GetSecretValue
            - dynamodb:DescribeTable
            - dynamodb:Query
            - dynamodb:Scan
            - dynamodb:GetItem
            - dynamodb:PutItem
            - dynamodb:UpdateItem
            - dynamodb:DeleteItem
            - s3:PutObject
            - sns:Publish
          Resource: "*"

functions:
  ...

resources:
  ...

package:
  individually: true

plugins:
  - serverless-dotenv-plugin
  - serverless-bundle
  - serverless-offline-sns
  - serverless-dynamodb-local
  - serverless-s3-local
  - serverless-offline
IgorAlexeew commented 1 year ago

This error occurs only with the latest versions of the serverless-offline, with version 8.8.1 everything is ok

scott-clary commented 1 year ago

I've come across the same issue

frameworkVersion: '3'

package:
  individually: true

provider:
  name: aws
  runtime: nodejs18.x
  region: ca-central-1
  httpApi:
    cors: true
    authorizers:
      customAuthorizer:
        type: request
        functionName: customAuthorizer
        identitySource: $request.header.Authorization
        enableSimpleResponses: true
        payloadVersion: '2.0'

  iam:
    role:
      statements:
        - Effect: Allow
          Action: 'secretsmanager:GetSecretValue'
          Resource: '*'
        - Effect: Allow
          Action:
            - dynamodb:Query
            - dynamodb:Scan
            - dynamodb:GetItem
            - dynamodb:PutItem
          Resource: "*"
        - Effect: Allow
          Action:
            - cognito-idp:AdminConfirmSignUp
            - cognito-idp:AdminCreateUser
            - cognito-idp:AdminInitiateAuth
            - cognito-idp:SignUp
            - cognito-idp:AdminRespondToAuthChallenge
            - cognito-idp:AdminUserGlobalSignOut
          Resource: "*"

plugins:
  - serverless-dotenv-plugin
  - serverless-bundle
  - serverless-offline

custom:
  bundle:
    disableForkTsChecker: true
    esbuild: true
    packager: yarn