Coder Social home page Coder Social logo

Comments (9)

gojko avatar gojko commented on May 11, 2024 1

I've never tried to create a lambda with a function in a subfolder; this might be a limitation of the lambda nodejs engine, not sure. I'll investigate that.

from claudia.

gojko avatar gojko commented on May 11, 2024 1

this is now available on NPM as 1.1.0. I've made the new version fully backwards compatible, so there was no need to bump major version.

from claudia.

tanepiper avatar tanepiper commented on May 11, 2024

I should also note is DOES create the Lamda, but shows no API Endpoints. It also creates the executor role, but nothing shows in the API Gateway.

from claudia.

gojko avatar gojko commented on May 11, 2024

I'm working on improving error messages now, they are not the most intuitive. in effect, this says that it can't locate the api module or cannot load it. your api module is --api-module app, so it's trying to require app and then find the apiConfig method on it. The module seems to be in a folder according to your example, so you may need to specify --api-module api/app

from claudia.

tanepiper avatar tanepiper commented on May 11, 2024

@gojko Ok cool that seemed to fix the deploy and it creates the API, but now when I go to the URL I get a stack trace in lambda:

{
errorMessage: "Cannot find module 'api/app'",
errorType: "Error",
stackTrace: [
"Function.Module._resolveFilename (module.js:338:15)",
"Function.Module._load (module.js:280:25)",
"Module.require (module.js:364:17)",
"require (module.js:380:17)"
]
}

So it doesn't seem to respecting the resolve paths for this as far as I can tell?

from claudia.

tanepiper avatar tanepiper commented on May 11, 2024

The claudia.json file generated is:

{
  "lambda": {
    "role": "myapp-executor",
    "name": "myapp",
    "region": "eu-west-1"
  },
  "api": {
    "id": "app-random-id",
    "module": "api/app"
  }
}

from claudia.

tanepiper avatar tanepiper commented on May 11, 2024

@gojko OK, thanks for that. In the meantime I'll try create it in the root folder and see how that works (as far as I can tell claudia should ignore most of the other project anyway?)

from claudia.

gojko avatar gojko commented on May 11, 2024

the rest should work ok. a trivial thing to do would be to create index.js in your root folder that just does module.exports = require('./app/api'), and you can use that as the claudia entry point, until we see how to use subfolders for api execution

from claudia.

gojko avatar gojko commented on May 11, 2024

I've added several checks to create and update that will report better on these issues and prevent common errors (9d2f8b8). From what I can see, there is no way to tell Lambda to execute a module handler in a subfolder, so the main api module has to be in root.

this is not on NPM yet, but it should be there as 2.0 soon

from claudia.

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.