serverless / components

The Serverless Framework's new infrastructure provisioning technology — Build, compose, & deploy serverless apps in seconds...
https://www.serverless.com
Apache License 2.0
2.31k stars 182 forks source link

Serverless component not deploying #877

Closed danim47c closed 2 years ago

danim47c commented 3 years ago

I am trying to deploy some components but I get the same error every time I execute severless command:

TypeError: Cannot redefine property: router
    at Function.defineProperty (<anonymous>)
    at Function.defaultConfiguration (/home/danim47c/.serverless/components/registry/npm/express@4.17.1/node_modules/express/lib/application.js:122:10)
    at Function.init (/home/danim47c/.serverless/components/registry/npm/express@4.17.1/node_modules/express/lib/application.js:62:8)
    at Template.load (/home/danim47c/advtechdev/towing-app-serverless/node_modules/@serverless/core/src/Component.js:116:34)
    at async fn (/home/danim47c/advtechdev/towing-app-serverless/node_modules/@serverless/template/utils.js:272:25)
    at async Promise.all (index 0)
    at async executeGraph (/home/danim47c/advtechdev/towing-app-serverless/node_modules/@serverless/template/utils.js:294:3)
    at async Template.default (/home/danim47c/advtechdev/towing-app-serverless/node_modules/@serverless/template/serverless.js:67:38)
    at async Object.runComponents `(/home/danim47c/advtechdev/towing-app-serverless/node_modules/@serverless/cli/src/index.js:220:17)
website:
  component: "@sls-next/serverless-component"

api:
  component: express
  inputs:
    src:
      src: ./api
      hook: npm run build
      dist: build
eahefnawy commented 3 years ago

@danim47c it seems that you are using a very old version of components, which is no longer maintained. Here's the latest on docs on the express component using the latest version of components: https://github.com/serverless-components/express

danim47c commented 3 years ago

@danim47c it seems that you are using a very old version of components, which is no longer maintained. Here's the latest on docs on the express component using the latest version of components: https://github.com/serverless-components/express

I have only copied the way is explained in the documentation of @sls-next/serverless-component

https://www.serverless.com/plugins/serverless-nextjs-plugin/

Thanks for answering

KrustyC commented 3 years ago

@danim47c Did you find a way to make @sls-next/serverless-component work with the new syntax? I am facing the exact same issue and I can't find anywhere a way where it is explained how to use the Next component with the new Serverless Components syntax