Skip to content
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(agora): build agora-api app as standalone app #2774

Merged

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Aug 27, 2024

Fixes #2773

Changelog

  • Bundle the dependencies with the agora-api app
  • Fix the task agora-api:build:production (see successful CI workflow run below)

Notes

Building the app will generate several warnings. Despite the "error", those are still warnings and the command exit status is successful (0).

$ nx run agora-api:build:production

...
WARNING in ../../../node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib/deps.js 45:35-75
Module not found: Error: Can't resolve '@aws-sdk/credential-providers' in '/workspaces/sage-monorepo/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib'

WARNING in ../../../node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib/deps.js 57:35-58
Module not found: Error: Can't resolve 'gcp-metadata' in '/workspaces/sage-monorepo/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib'

WARNING in ../../../node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib/deps.js 69:22-39
Module not found: Error: Can't resolve 'snappy' in '/workspaces/sage-monorepo/node_modules/.pnpm/[email protected][email protected]/node_modules/mongodb/lib'

These warnings (there are more warning that are related to other libraries) occur because the MongoDB library you're using has optional dependencies that are not installed in your project. These are usually dependencies that MongoDB can optionally use for certain features, such as AWS credential providers, Google Cloud Platform metadata, and the snappy compression library. Since these are optional, MongoDB does not require them for basic operation, but Webpack is warning you that it cannot find these modules.

Despite these warnings, the app works fine.

$ nx build-image agora-api
$ nx serve-detach agora-api

# OR

$ nx serve agora-api

Check:

$ curl 'http://localhost:3333/v1/dataversion'
{"_id":"66ce25afebad76c9018e119e","data_file":"syn13363290","data_version":"68","team_images_id":"syn12861877"}

@tschaffter tschaffter marked this pull request as ready for review August 27, 2024 20:14
@tschaffter tschaffter requested a review from a team as a code owner August 27, 2024 20:14
Copy link
Contributor

@sagely1 sagely1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commands specified in the PR run great!

@tschaffter tschaffter merged commit 574d8b0 into Sage-Bionetworks:main Aug 27, 2024
11 of 12 checks passed
@tschaffter tschaffter deleted the agora/build-app-standalone branch August 27, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] agora-api fails to build Docker image after migrating to pnpm
2 participants