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

Warning: found unsupported runtime 'provided' #570

Closed
awhitford opened this issue Jan 14, 2019 · 21 comments
Closed

Warning: found unsupported runtime 'provided' #570

awhitford opened this issue Jan 14, 2019 · 21 comments

Comments

@awhitford
Copy link

I need NodeJS 10, so followed instructions found here.

But then, it appears that Serverless-Offline does not work. I see this:

Serverless: Warning: found unsupported runtime 'provided'

And my routes are not emitted.

This issue seems related to #562.

@dherault
Copy link
Owner

Which serverless and serverless-offline version are you using ? Try v3.33.0

@dherault
Copy link
Owner

Also check your serverless.yml file for typos :)

@awhitford
Copy link
Author

awhitford commented Jan 14, 2019

Using Serverless 1.36.0 and serverless-offline 3.32.2.
I tried 3.33.0, but still same behavior.

Response is like:

{"statusCode":404,"error":"Serverless-offline: route not found.","currentRoute":"get - /hello","existingRoutes":[]}

@dherault
Copy link
Owner

What about your serverless.yml file ?

@awhitford
Copy link
Author

As the blog post describes (so that I can specify NodeJS 10), the serverless.yml looks like:

plugins:
  - serverless-webpack
  - serverless-offline

provider:
  name: aws
# runtime: nodejs8.10
  runtime: provided

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          method: get
          path: hello
    layers:
      - arn:aws:lambda:us-east-1:553035198032:layer:nodejs10:4

@dherault
Copy link
Owner

I see. The plugin does not support a provided runtime yet. But I'm confident it will in the future. Thank you for your issue.

@BenEllerby
Copy link

@dherault if you are using a custom runtime, in my case PHP, though a Lambda layer providing the binary and boostrap file, is it possible to make use of this plugin to emulate api gateway and lambda up to the point where the binary is executed?

The custom binary has been setup in a similar way to https://aws.amazon.com/blogs/apn/aws-lambda-custom-runtime-for-php-a-practical-example/ but with all layers configured inside the serverless.yml.

(serverless-offlineworks great standard runtimes 👍)

@dherault
Copy link
Owner

@BenEllerby I'm sorry but the plugin can't do that. It looks like serverless-offline will not handle provided runtimes until serverless can invoke them.

@BenEllerby
Copy link

OK @dherault thanks for the help 👍

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented Feb 12, 2019

@awhitford just had the same problem.

as an interim, you can use serverless variables, e.g.

provider:
  runtime: ${self:custom.runtime.${env:NODE_ENV}}  # or ${opt:stage} alternatively

custom:
  runtime:
    localhost: nodejs8.10 # even just "nodejs" works
    development: provided
    production: provided

serverless-offline doesn't care which node version you really run locally. it only uses the runtime parameter to distinguish between the supported node.js, python, and ruby runtimes.

@dherault I wonder if it would be a good idea for serverless-offline to use custom options (same as for port, prefix etc.) to support runtime: provided until it's fully supported?

e.g. something along those lines:

provider:
  runtime: provided

custom:
  serverless-offline:
    port: 8300
    runtime-provided: nodejs  # this option should be allowed to be set only if the provider runtime option is set to: provided

@dherault
Copy link
Owner

Hello @dnalborczyk that is a nice idea! We would gladly accept a PR implementing this. I'll put it on my check list for in case I get a few minutes to work on it.

@dherault
Copy link
Owner

I did it. You can now set the providedRuntime CLI option or put it under custom.serverless-offline.providedRuntime. v4.4.2

@dnalborczyk
Copy link
Collaborator

@dherault nice! thank you!! just installed it and it works great!

@harmenjanssen
Copy link

Serverless can now invoke provided runtimes, I think as of this PR: serverless/serverless#5863

Would it therefore be possible to make Serverless Offline work with other provided runtimes, like PHP?

Is there anything I could do? I would really like to run a local APIGateway server for my PHP lambda functions, and am more than happy to help with a PR.

@dherault
Copy link
Owner

dherault commented Apr 4, 2019

Hi @harmenjanssen , I don't think a PR on the subject would be that easy since we don't use docker in the first place... But you can try !

@harmenjanssen
Copy link

Ha, I was hoping for a little more strategy. 😉
Above you indicate that "It looks like serverless-offline will not handle provided runtimes until serverless can invoke them.".

I was hoping, based on that statement, that now that Serverless does invoke provided runtimes, you already had an idea of how to integrate?

@atrope
Copy link

atrope commented May 5, 2019

@dherault I Took a look and found out that it is fairly easy to support provided runtimes.

I Could make a PR if you think it's worth it.

brefphp/bref#320 (comment)

@dnalborczyk
Copy link
Collaborator

dnalborczyk commented May 5, 2019

I Could make a PR if you think it's worth it.

@atrope absolutely, do it!!

@atrope
Copy link

atrope commented May 5, 2019

@dnalborczyk can you please have a look in the PR and help testing it?

@dnalborczyk
Copy link
Collaborator

@atrope yes, will do! probably later today ...

@dnalborczyk
Copy link
Collaborator

@atrope I got it running yesterday, and generally, it seems to work. although I noticed a couple things which might need some changes or fixes, and I'm not sure about the expectations and the work flow in general. that might be better answered by @dherault . I'll try to write some comments later today in the PR.

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

Successfully merging a pull request may close this issue.

6 participants