Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mazensharkawy opened this issue Sep 17, 2023 · 0 comments

Comments

@mazensharkawy
Copy link

mazensharkawy commented Sep 17, 2023

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 
      - "/*"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant