Deploying a serverless application

Hi,
New to serverless, writing my first program and will probably sound dumb :slight_frown: with the question.

Ran the hello world and realized that “serverless deploy” looks for serverless.yml. I downloaded a sample application which had a s-function.json, s-resources-cf.json and other files but no serverless.yml. While trying to deploy resources, i get an error which says “command resources not found”. What am i missing? Thanks in advance.

Hey @amatmakur,

The sample you downloaded was for a Serverless v0.5x project and you are probably using serverless v1.0.0-rc2.

What I would do is create a new folder, go into that folder and then create a new serverless service using serverless create --template aws-nodejs --name my-special-service (assuming you are creating a nodejs service, see https://github.com/serverless/serverless/blob/master/docs/01-guide/02-creating-services.md) and then move in just the javascript code from the sample project that you need, and not the surrounding old-style serverless project configuration.

Cheers!

  • Ian

Just to add to @ianserlin’s already good answer: v0.x and v1.x Serverless projects are completely different. The project was re-written, so you can basically assume that anything for v0.x is irrelevant for you v1.x service.

1 Like

Thank you @ianserlin and @rowanu. I now run into a different problem. My js file has the const request = require(‘request’); and i get an error saying “Cannot find module ‘request’”. I am running v1.0.1-rc.2. Should i explicitly define the dependency on npm_modules somewhere in my configuration? If not, how could i fix this issue?

Hi, an upgrade of the serverless solved this problem :slight_smile: