lambda functions can't be placed in sub directories
See original GitHub issueThis issue is a spin-off of #846
On Netlify, if you want to have the serverless function hello you can either have the file functions/hello.js or functions/hello/hello.js
Redwood currently only supports the first of those two options (functions/hello.js)
This issue is about adding support for the second way of doing it as well. Plus, possibly, functions/hello/index.js
All three options would result in a function available at http://localhost:8911/hello
Netlify’s docs for this are here https://docs.netlify.com/functions/build-with-javascript/
Potential steps brought over from the linked Issue
- Determine how many levels on nesting is supported on netlify, vercel, etc. Netlify: Only one level. Vercel: Unlimited
- Make the import code support nested subdirectories.
- Make the various parts that reference the “name” work with subdirectories.
- Write tests.
(Personally I don’t have a need for this right now, so anyone else; please feel free to pick this up if you want to)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to include a subdirectory of libraries in an AWS Lambda ...
With layers, you can use libraries in your function without needing to include them in your deployment package.
Read more >Recursive patterns that cause run-away Lambda functions
Recursive patterns that cause run-away Lambda functions. AWS services generate events that invoke Lambda functions, and Lambda functions can send messages to ...
Read more >Python Lambda handler in sub directory - Serverless Forums
I'm trying to define multiple Lambdas in one serverless.yml to be used in a Step Functions state machine.
Read more >Does Netlify Lambda support sub-directory ? · Issue #90
Here's how I've added it so I can put my lambdas in a subdir - so I can use it with .netlify/function/net/lify ....
Read more >Creating folders and subfolders in an S3 bucket using ...
... create folders and subfolders in an S3 bucket using Lambda Functions? ... in it you would put two objects to S3 with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Would like to just add my use case here for this feature
With the redwood app I am working on, we integrate with different services. We are working on a Slack app, Intercom app, Zapier App etc.
We use the serverless functions to the do following functionality:
So the project right now sits at close to 20 functions, and we are not yet done with the integrations we want to develop.
For code organization, I have used the following naming scheme, to make things a bit more manageable. [platform]-[function].js
e.g. intercom-oauth-callback.js, slack-auth.js
Another use case is the use of libraries such as https://quirrel.dev/ - which will greatly benefit from folder support. As each “queue” is a serverless function.
Having an Express app as a router on the top level (
/feedin this case) is exactly what Netlify themselves use in their examples, so I think that’s a perfectly valid approach. To get that to work on Vercel I had to do some tricks with thevercel.jsonconfig files and the routing in there.So if we choose this route (sorry 😛😁) we need to do this setup on Vercel as part of deployment.
next.js does some magic with their
/pages/apifolder. So it’s not impossible, just a bit of work 😃