Comments (22)
Thanks so much for releasing 2.0.0. I have it working in my main repo now and the serverless.yml
is so much smaller now!
from serverless-plugin-modularize.
@Shereef I tested locally, I was able to reproduce the issue. I'm wondering if its a conflict with serverless 3.0 since this was targeting 2 when it was published.
from serverless-plugin-modularize.
Yeah, I bet they check if there are any functions in the main file and ignore any subsequent checks for those files.
from serverless-plugin-modularize.
serverless modularize info
Environment: darwin, node 14.18.2, framework 3.0.0 (local), plugin 6.0.0, SDK 4.3.0
Credentials: Local, "default" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "custom.newRelicUserKey": An error occurred while calling one AWS dependency service.
serverless.yml
custom:
newRelicUserKey: ${ssm:/aws/reference/secretsmanager/NewRelicAPIKey}
newRelic:
accountId: 123456789
cloudWatchFilter: '*'
apiKey: ${self:custom.newRelicUserKey.NEW_RELIC_USER_KEY}
linkedAccount: 'someAccount'
from serverless-plugin-modularize.
When I comment out the new relic stuff then also remove the helloWorld function from the main serverless.yml which means the only functions now are in the health module
npx serverless modularize info
modularize: src/health/serverless.module.yml
{
"functions": {
"healthCheck": {
"handler": "dist/src/health/handler.check"
},
"healthVersion": {
"handler": "dist/src/health/handler.version"
}
}
}
✖ Uncaught exception
/Users/shereef.marzouk/Dev/some/service/node_modules/serverless/scripts/serverless.js:46
throw error;
^
ServerlessError: Function "healthVersion" doesn't exist in this Service
at Service.getFunction (/Users/shereef.marzouk/Dev/some/service/node_modules/serverless/lib/classes/service.js:314:11)
at ServerlessGitVariables.exportGitVariables (/Users/shereef.marzouk/Dev/some/service/node_modules/serverless-plugin-git-variables/lib/index.js:198:44) {
code: 'FUNCTION_MISSING_IN_SERVICE',
decoratedMessage: undefined
}
if I comment out either of the remaining functions it works fine.
I don't understand! Surely modularize can support more than 1 function in a module/lambda
What am I doing wrong ?
from serverless-plugin-modularize.
The modularize plugin can handle as many functions per module as you want to add (assuming whatever cloud platform you use accepts it). Have you tried adding the modularize plugin as the first plugin on the list so it is ran before the others?
from serverless-plugin-modularize.
Thanks for your response
I tried that first thing but it errored out
I can't remember the error but I'll post that tomorrow
from serverless-plugin-modularize.
@Shereef Sounds good, let me know.
from serverless-plugin-modularize.
I also noticed you had some files in the dist/src/... etc. If the root level serverless.yml has the global pattern src/...
it won't look in the dist directory.
from serverless-plugin-modularize.
That was one of the things I tried as well
I will update you tomorrow thnx
from serverless-plugin-modularize.
The dist folder is for JS files the repo has the yml in src not in dist
from serverless-plugin-modularize.
The kids are asleep I thought I would give you the responses today since you are active now
plugins:
- serverless-plugin-modularize
- serverless-plugin-git-variables
- serverless-prune-plugin
- serverless-appsync-plugin
- serverless-newrelic-lambda-layers
Packaging
AppSync Plugin: GraphQl schema valid
Plugins: ["serverless-plugin-modularize","serverless-plugin-git-variables","serverless-prune-plugin","serverless-appsync-plugin","serverless-newrelic-lambda-layers"]
Please use a valid New Relic API key as your apiKey value; skipping.
✖ Uncaught exception
Environment: darwin, node 14.18.2, framework 3.0.0 (local), plugin 6.0.0, SDK 4.3.0
Credentials: Local, "sandbox" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Function "healthVersion" doesn't exist in this Service
No New Relic AWS Lambda integration found for this New Relic linked account and aws account.
Please enable the configuration manually or add the 'enableIntegration' config var to your serverless.yaml file.
Retrieving CloudFormation stack
from serverless-plugin-modularize.
When I played around with the order of plugins and commented new relic out
Deploying some-service to stage sandbox (us-east-1)
Packaging
AppSync Plugin: GraphQl schema valid
Plugins: ["serverless-plugin-git-variables","serverless-prune-plugin","serverless-appsync-plugin","serverless-newrelic-lambda-layers","serverless-plugin-modularize"]
Please use a valid New Relic API key as your apiKey value; skipping.
No New Relic AWS Lambda integration found for this New Relic linked account and aws account.
Please enable the configuration manually or add the 'enableIntegration' config var to your serverless.yaml file.
Retrieving CloudFormation stack
Uploading
Uploading CloudFormation file to S3
✖ Stack daysmart-booking-service-sandbox failed to deploy (2s)
Environment: darwin, node 14.18.2, framework 3.0.0 (local), plugin 6.0.0, SDK 4.3.0
Credentials: Local, "sandbox" profile
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource HealthVersionLambdaFunction
from serverless-plugin-modularize.
I have created this repo where I have replicated the issue
I hope this is helpful
P.S. Each commit that has a comment icon is for you to look at
from serverless-plugin-modularize.
@icarus-sullivan Any help would be appreciated
from serverless-plugin-modularize.
I tried downgrading to serverless 2 and pushed my try to the repo above. The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource HealthVersionLambdaFunction
Thanks so much for trying it locally. is there anything you think I can try ?
from serverless-plugin-modularize.
@Shereef I just released a v2.0.0, which uses serverless internal merging for service-level additions. If you have time please give it a try and let me know if it resolved issues for you.
from serverless-plugin-modularize.
@icarus-sullivan: I can't get it to work I created this branch https://github.com/Shereef/modularize-issue/commits/simple-sls3-slspmod2 to try it and the modularize merged shows functions correctly but when you deploy it doesn't have functions at all
Shmac:modularize-issue shereef.marzouk$ npm run deploy
> [email protected] deploy
> npm run build && sls deploy --stage sandbox --aws-profile sandbox --verbose
> [email protected] build
> tsc --build --verbose --pretty
[4:32:34 AM] Projects in this build:
* tsconfig.json
[4:32:34 AM] Project 'tsconfig.json' is up to date because newest input 'src/shared/functions.ts' is older than oldest output 'dist/src/shared/functions.js'
Deploying some-booking-service to stage sandbox (us-east-1)
Packaging
Retrieving CloudFormation stack
Creating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Executing created change set
CREATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CREATE_IN_PROGRESS - AWS::S3::Bucket - ServerlessDeploymentBucket
CREATE_COMPLETE - AWS::S3::Bucket - ServerlessDeploymentBucket
CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CREATE_IN_PROGRESS - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CREATE_COMPLETE - AWS::S3::BucketPolicy - ServerlessDeploymentBucketPolicy
CREATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Uploading
Uploading CloudFormation file to S3
Updating CloudFormation stack
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - some-booking-service-sandbox
UPDATE_COMPLETE - AWS::CloudFormation::Stack - some-booking-service-sandbox
Retrieving CloudFormation stack
Removing old service artifacts from S3
✔ Service deployed to stack some-booking-service-sandbox (67s)
Stack Outputs:
ServerlessDeploymentBucketName: some-booking-service-san-serverlessdeploymentbuck-16kzaq4d88sbb
Shmac:modularize-issue shereef.marzouk$ npx serverless modularize info
modularize: src/health/serverless.module.yml
{
"functions": {
"healthCheck": {
"handler": "dist/src/health/handler.check"
},
"healthVersion": {
"handler": "dist/src/health/handler.version"
}
}
}
Shmac:modularize-issue shereef.marzouk$ npx serverless modularize merged
modularize: {
"plugins": [
"serverless-plugin-modularize"
],
"custom": {
"modularize": {
"glob": "src/**/*.module.yml"
}
},
"provider": {
"name": "aws",
"runtime": "nodejs14.x",
"memorySize": 128,
"timeout": 120,
"region": "us-east-1",
"stage": "dev",
"versionFunctions": true
},
"functions": {
"healthCheck": {
"handler": "dist/src/health/handler.check"
},
"healthVersion": {
"handler": "dist/src/health/handler.version"
}
}
}
Shmac:modularize-issue shereef.marzouk$
from serverless-plugin-modularize.
I think we will need to work with @serverless to fix this.
it works fine if I have 1 function in the serverless.yml
so I think it's the serverless code that's not deploying the functions even though they exist in the runtime config after service.update
.
from serverless-plugin-modularize.
I created #16 we can close this one
Thanks so much!
from serverless-plugin-modularize.
Was it [email protected] that got it to work?
from serverless-plugin-modularize.
The latest [email protected]
2.72.2 wasn't even getting the functions in the merged command
from serverless-plugin-modularize.
Related Issues (9)
- Glob potentially broken
- Property reference resolution implemented? HOT 14
- Modularize doesn't work if the `serverless.yml` doesn't have any functions HOT 5
- Modularize plugin not merging custom.appSync.dataSources correctly HOT 7
- Variables not resolving in modularized templates after upgrading to variablesResolutionMode HOT 1
- Resources are not merged together HOT 3
- Outputs (inside the "resources" section) are not merged together HOT 3
- Add additional properties to merge function
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 serverless-plugin-modularize.