Comments (9)
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.
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.
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.
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.
@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.
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.
@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.
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.
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)
- Anyway to delete a specific version of lambda? HOT 1
- --no-optional-dependencies not working as expected HOT 8
- Using npm files property, temporary directory on MAC ignored HOT 3
- How to debug the application locally HOT 5
- Cannot find module error during create HOT 1
- first time use Claudiajs create in region China error NetworkingError HOT 1
- claudia pack does not work with npm workspaces
- Lambda function fails to deploy to CF distribution with TLSv1.2_2019 set
- Vulnerabilities and oudated packages
- Outdated Packages HOT 1
- ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda: HOT 49
- AWS launches ARM-powered Lambdas HOT 3
- no handler for POST / with api builder and claudia-local-api
- How to set provisioned concurrency in create/update commands?
- Add Cognito User Pool Trigger throws `Unexpected key 'UsernameConfiguration' found in params`
- Claudia Update will not deploy with AWS SSO Credentials
- Claudia with Node 14 and ES6 HOT 1
- Setting more than one environment variable with --set-env fails with TypeError
- Running `claudia create` with expressjs api results in `Error: Cannot find module '{module}'`
- Migrate AWS SDK for JavaScript v2 APIs to v3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from claudia.