Giter VIP home page Giter VIP logo

Comments (8)

logandk avatar logandk commented on May 28, 2024

If you look inside the zip file created by serverless, du you see a .requirements directory?

from serverless-wsgi.

jsnowacki avatar jsnowacki commented on May 28, 2024

Yes, everything is in place and the "missing" werkzeug is in the folder. I think the problem might be with the python path adding, but I cannot check it, at least easily, as wsgi.py, which is the main point of entry, does not load.

from serverless-wsgi.

logandk avatar logandk commented on May 28, 2024

I just tried deploying the example from the README, using this serverless.yml file:

service: example

provider:
  name: aws
  runtime: python2.7

plugins:
  - serverless-wsgi

package:
  exclude:
    - node_modules/**

functions:
  api:
    handler: wsgi.handler
    events:
      - http:
          path: cats
          method: get
          integration: lambda-proxy
      - http:
          path: dogs/{id}
          method: get
          integration: lambda-proxy

custom:
  wsgi:
    app: api.app

Producing the following Lambda bundle:

https://dl.dropboxusercontent.com/u/313905/example.zip

Could you check how it compares to your bundle?

from serverless-wsgi.

jsnowacki avatar jsnowacki commented on May 28, 2024

OK I've found that the datastructures.py from werkzeug were missing. The reason was that in my serverless.yml I had exclude as follows:

exclude:
    - data

This meant to exclude my data folder; when I changed it to - data/ only the folder is excluded correctly. I was not aware that this form of exclude works as a global wildcard.

Nonetheless, I get a new error now:

u'requestContext': KeyError Traceback (most recent call last): File "/var/task/wsgi.py", line 34, in handler script_name = '/
{}
'.format(event[u'requestContext'].get(u'stage', '')) KeyError: u'requestContext'

It may be related with the fact I' using CORS in Serverless:

events:
      - http:
          path: task
          method: get
          integration: lambda-proxy
          cors: true

from serverless-wsgi.

logandk avatar logandk commented on May 28, 2024

Strange, enabling CORS does not cause any issues for my example (it shouldn't, as the CORS setting will just add an OPTIONS method to APIGW).

According to AWS docs, requestContext should always be available for LAMBDA-PROXY integrations. Could you check in API Gateway, that your endpoint is indeed configured with a LAMBDA-PROXY integration? Also, I assume that you're seeing that error in the logs after invoking the Lambda through a HTTP call to API Gateway, right?

screen shot 2016-10-15 at 18 57 07

from serverless-wsgi.

jsnowacki avatar jsnowacki commented on May 28, 2024

The last one did the trick, though, for some reason, serverless.yml setting as above, i.e.:

events:
      - http:
          path: task
          method: get
          integration: lambda-proxy
          cors: true

doesn't change the Integration Request: I had to change it manually. Also I've tested it on a vanilla environment and it still doesn't trigger the integration setting. But after setting it manually, Serverless doesn't change the setting back, so it's fine for now at least.

I also tested it adding two new endpoints foo and bar, with and without CORS, respectively. In both cases the lambda-proxy setting hasn't been added.

Do you think this is related with your project or should I report it to Serverless directly?

Thank you very much for the help!

from serverless-wsgi.

logandk avatar logandk commented on May 28, 2024

Ok, great that you found the issue. It definitely sounds like a Serverless bug, and you should be able to reproduce regardless of using this plugin. I'll close this issue and it would be cool if you could report directly to Serverless!

from serverless-wsgi.

jsnowacki avatar jsnowacki commented on May 28, 2024

Just leaving a note: the issue with setting integration was related to older version of Serverless I had, namely, 1.0.0-rc2; after updating to 1.0.2 the issue dissipated.

from serverless-wsgi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.