-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: serverless failing #162
fix: serverless failing #162
Conversation
6da1cd1
to
5ae61b7
Compare
c19c2c3
to
16ba61f
Compare
5ae61b7
to
fe06242
Compare
16ba61f
to
9d84734
Compare
fe06242
to
9567898
Compare
@@ -24,7 +24,9 @@ module.exports = { | |||
filename: '[name].js', | |||
}, | |||
target: 'node', | |||
externals: [nodeExternals()], | |||
externals: [nodeExternals({ | |||
allowlist: [new RegExp("@wallet-service/common*")], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bundle gets too big if we allow webpack to bundle all dependencies so we remove them from the bundle (they get loaded in runtime)
But we can't do this with the common module, otherwise it would not be seen by the serverless-monorepo package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I agree with your suggestion to move on with this PR and investigate the peer dependencies issue through a KTLO.
My recommendation would be to add the issue number to this PR description now, so that it's easier to track these changes in the future.
9d84734
to
25261a1
Compare
9567898
to
4bbbf6b
Compare
c2fe235
to
8deea8b
Compare
…methods in wallet-service package
8deea8b
to
b21d3f3
Compare
* chore: added common package * chore: using wallet-lib from daemon resolution * chore: installed shared dependencies on root project, using peerDependencies * refactor: using addAlert method from common utils * chore: updated package.json with missing deps * refactor: using types from commons on wallet-service * chore: re-added sequelize to root * refactor: removed isNftAutoReviewEnabled from services * tests: mocked assertEnv * tests: mocked assertEnv on integration tests * chore: removed nft utils * refactor: removed old addAlerts from the wallet-service package * chore: wallet-lib is now a peerDependency in wallet-service package * refactor: logger is now a required param in addAlert, refactored all methods in wallet-service package * docs: added missing hathor header * refactor: invalid type for metadata on addAlert * tests: passing mocked logger * chore: updated gitignore to ignore env files * chore: revert eslint package updates * refactor: using types from commons on wallet-service * refactor: removed unused commented line * chore: missing package in daemon * refactor: using transaction type from common * refactor: bitcoinjs is not a shared dep * chore: added a comment explaining that logger is a param temporarily * refactor: removed default from metadata * chore: lint fixes and package ordering * feat: call onNewNftEvent when a new NFT tx is received (#150) * feat: added nft utils * tests: added tests for common utils * chore: added common module to CI * refactor: moved used types to common package * tests: removed nft utils * tests: fixed nft tests on txProcessor * tests: mocking network on getconfig * tests: fixed nft tests on txProcessor * refactor: passing logger to invoke nft handler * refactor: no need to ignore ts * chore: removed jest script, instead using only test * chore: added hathor header * refactor: using common utils on txProcessor * tests: nft utils using old syntax * tests: skipped txProcessor tests * tests: fixed txProcessor tests * refactor: using isAuthority from common utils * refactor: using isAuthority from common types * refactor: using assertEnvVariablesExistance from common project * refactor: getting CREATE_NFT_MAX_RETRIES from env * docs: updated docstrings on nft utils * chore: removed events/nftCreationTx.ts * refactor: invalid import locations * refactor: remove unused lambdas (#155) * tests: fixed nft tests on txProcessor * refactor: removed all methods related to the old wallet-service txProcessor * tests: fixed failing test * fix: serverless failing (#162) * refactor: logger is now a required param in addAlert, refactored all methods in wallet-service package * chore: changed module resolution and several package locks * chore: added common library to externals whitelist and whitelisted it in tsloader * chore: wallet-service common package moved from direct path to workspace * chore: added common as a peer dependency and restored peer dependencies * chore: removed peer dependencies as they were not working with serverless-monorepo * chore: added comment on hoisting limits * chore: added comment explaining externals in webpack
Motivation
Serverless was failing to package because of multiple issues related to the new yarn workspaces monorepo structure:
Upon investigation, I found out that this was happening because it yarn workspaces symlinks internal modules to the package's
node_modules
andserverless-monorepo
was cleaning itThe fix for this issue was adding it as a peer dependency, which actually copied the dependency to the
node_modules
folder and also adding it to be parsed by thets-loader
This is a weird one, but after we solved the issue with the common module, the package was failing in runtime because of errors on the imports
I wasn't to dive deep into why this was the case, but moving the peer dependencies to be dependencies fixed this issue.
My suggestion is to move on with this PR because it is stopping us from fixing a bug affecting our production server (NFT metadata is not being created on S3) and investigate in a KTLO in the near future.
The side effect is only that
yarn install
will take a little longer because it will not hoist the peer dependencies into the root package.Acceptance Criteria
Checklist
master
, confirm this code is production-ready and can be included in future releases as soon as it gets merged