Skip to content

TypeError: elements.map is not a function on running serverless cloudfrontInvalidate #44

Description

@mazensharkawy

On running serverless cloudfrontInvalidate I get the following error

Environment: linux, node 14.21.3, framework 3.35.2, plugin 7.0.2, SDK 4.4.0
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
Error:
TypeError: elements.map is not a function
    at CloudfrontInvalidate.invalidateElements (/opt/atlassian/pipelines/agent/build/node_modules/serverless-cloudfront-invalidate/index.js:100:43)
    at CloudfrontInvalidate.invalidate (/opt/atlassian/pipelines/agent/build/node_modules/serverless-cloudfront-invalidate/index.js:161:17)
    at PluginManager.runHooks (/usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:530:15)
    at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:564:20)
    at async PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/plugin-manager.js:604:7)
    at async Serverless.run (/usr/local/lib/node_modules/serverless/lib/serverless.js:179:5)
    at async /usr/local/lib/node_modules/serverless/scripts/serverless.js:819:9

This is my serverless.yml file

service: Lebara-Frontend


provider:
  name: aws
  runtime: nodejs18.x
  stage: ${opt:stage, 'dev'}
  region: ${env:AWS_DEFAULT_REGION, '*****'}
  bucketName: ${env:AWS_BUCKET_NAME, '******'} 

plugins:
  - serverless-finch
  - serverless-cloudfront-invalidate

custom:
  client:
    bucketName: ${self:provider.bucketName}
    distributionFolder: build
    indexDocument: index.html
    errorDocument: index.html
    objectHeaders:
      'static/':
        - name: Cache-Control
          value: 'max-age=31536000'
      '*.png':
        - name: Cache-Control
          value: 'max-age=31536000'
  cloudfrontInvalidate:
    distributionId: ${env:DISTRIBUTION_ID}
    items: # one or more paths required 
      - "/*"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions