Comments (9)
Hi,
The zip file will indeed include the aws-sdk
. This is expected behavior.
The aws-sdk is used by the persistence package to call DDB, S3, etc. The deployment package uses it for a few minor things related to bulk export(uploadGlueScriptsToS3.ts#L7)
It looks like the search package does not actually use the aws-sdk package, so we could clean up and remove it from the dependencies. This won't reduce the zip size though, since yarn resolves the dependencies for all packages and includes a single copy of the aws-sdk for the entire project.
You are right in that one of the main changes in the aws-sdk v3 is the ability to import individual modules for different AWS services whereas v2 is a single import that includes ALL aws services. Switching to v3 would reduce the our zip size since we only use clients for a handful of aws services (DDB, S3, Lambda, Step Functions, ES, etc. ). V3 is fairly recent (it went GA on Dec 15 2020) and it is not a drop in replacement for v2. We haven't prioritized making the upgrade.
It's worth noting that with a recent update(#240) to use webpack, the size of the zip package has been significantly reduced.
from fhir-works-on-aws-deployment.
Hi,
Is there a reason why aws-sdk
is packed into the zip file - it is already available in the default Lambda layer when the function executes so doesn't need to be there?
Thanks,
Allan
from fhir-works-on-aws-deployment.
For apps in production it is a good practice to bundle the aws-sdk in order to pin it to the exact version that you are using to build and test your code.
from fhir-works-on-aws-deployment.
Yes that is a good point.
Looking at it pragmatically though the version of aws-sdk
provided by the Lambda layer will always be 2.x.x so it is very unlikely that there will be a breaking change if semver is correctly followed by the sdk team.
Plus the dependency in each of the package.json files is specified using ^
so the minor & patch versions of the sdk used during fhirworks component test & release may well be different to that used when the component is installed in the deployment package.
from fhir-works-on-aws-deployment.
A breaking change is unlikely indeed, but there may be still be subtle changes in the sdk behavior. The recommended best practice is to fully control the dependencies in your function's deployment package.
https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html#function-code
The yarn.lock
file pins all packages to a specific version that fulfills the version ranges from the package.json
files. This ensures that the exact same versions are used for building/testing and in prod
https://classic.yarnpkg.com/en/docs/yarn-lock/
from fhir-works-on-aws-deployment.
OK how about this as an approach:
If the FWoA sub components (persistence-ddb, search-es etc) are made independent of aws-sdk
then we can follow best practice by including the sdk in the deployment component.
And then if a developer chooses to use the built in aws-sdk
(and accept the potential pitfalls of this), they can do this by not including it in the deployment component.
from fhir-works-on-aws-deployment.
If the FWoA sub components (persistence-ddb, search-es etc) are made independent of aws-sdk then we can follow best practice by including the sdk in the deployment component.
Risk here will come from versioning ddb
and es
components, as say version 1 of ddb
requires aws-sdk of 2.5 and ES
requires 3.2 and then the deployment package dictates aws-sdk of 3.4. This will lead to either breaks or inconsistencies if the sub packages can't declare their own dependencies.
By default we want each FWoA packages to have all the dependencies they need. That said if the developer wants to remove it themselves they certainly can, but the mainline packages will keep the dependencies.
Thoughts?
from fhir-works-on-aws-deployment.
Hi Robert,
Yes I totally agree with what you are saying here, it is best to have full control of your dependencies.
My main rationale behind not wanting the aws-sdk
inside the zipfile is to reduce package size to achieve better cold start performance, as I believe that this is the most significant factor in slow start ups.
I'm taking a pragmatic line here rather than following textbook - I don't believe that we'll ever see a version of aws-sdk
greater than v2.x because v3 of the sdk is now being published with the @aws-sdk
scope. You may know more than this though! Once the FWoA components are migrated v3.x code-size becomes less of an issue because of the modular approach, I haven't looked at this enough to know what impact it has though.
Thanks,
Allan
from fhir-works-on-aws-deployment.
+1 yeah I think migrating to v3 will be a good middle ground :)
from fhir-works-on-aws-deployment.
Related Issues (20)
- the redirect flows calls https://https:// HOT 1
- [Feature Request] Enable Cors.
- How to recover from manually deleting the API Gateway?
- Fetching last added Observation via rest API doesn't return the resultset on first call HOT 3
- Clinical Data HOT 26
- Deploying with pre-existing KMS keys? HOT 2
- XML format accept in API request HOT 2
- OpenSearch cost HOT 5
- [Bug] Patient created with tags appears in DB not being returned by GET to patient endpoint HOT 19
- [Bug] Unable to compile JP-CORE v1.1.0 Implementation Guides HOT 6
- [Misc] Unable to search AllergyIntolerance when adding patient parameter to URL HOT 6
- [Misc] Physical Deletion of Resources HOT 4
- [Misc] About Resource Updates HOT 7
- [Misc] About Encounter Resource Search HOT 6
- Update contention handling HOT 5
- About Conditional Create at fhir-works-on-aws HOT 6
- [Misc] Lambda Task timed out HOT 5
- [Bug] canonical search queries not working HOT 8
- how are you supposed to figure out the patientPickerEndpoint? HOT 2
- [Misc] validating a QuestionnaireResponse against questionnaire HOT 2
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 fhir-works-on-aws-deployment.