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

Update Nest.js deps #637

Merged
merged 7 commits into from Mar 23, 2021
Merged

Update Nest.js deps #637

merged 7 commits into from Mar 23, 2021

Conversation

pcaisse
Copy link
Contributor

@pcaisse pcaisse commented Mar 19, 2021

Overview

Update all Nest.js deps, including the "microframework" packages such as @nestjsx/crud and @nestsx/crud-typeorm and their peer dependencies

Checklist

  • Description of PR is in an appropriate section of CHANGELOG.md and grouped with similar changes, if possible

Notes

I tried to make the commit messages nice and descriptive so I'd recommend looking at those one-by-one.

There are some warnings shown when running yarn install around unmet peer dependencies, but we don't use those dependencies for templates in email (we're using handlebars) and so they should optional and the warnings can be safely ignored:

warning " > @nestjs-modules/mailer@1.5.1" has unmet peer dependency "@types/ejs@^3.0.3".
warning " > @nestjs-modules/mailer@1.5.1" has unmet peer dependency "@types/pug@2.0.4".
warning " > @nestjs-modules/mailer@1.5.1" has unmet peer dependency "ejs@^3.1.2".
warning " > @nestjs-modules/mailer@1.5.1" has unmet peer dependency "pug@^2.0.4 || ^3.0.0".

Testing Instructions

  • Run scripts/update and then scripts/server
  • Click around the app, exercising as much of its functionality as possible to make sure everything still works. I did this:
    • Register new user
    • Log out/log in
    • Create new map
    • Assign districts
    • Share
    • Export CSV

Closes #602

via `nest update -f -t latest` (see
nestjs/nest-cli#321 (comment))

TypeORM was also upgraded separately via `yarn upgrade --latest typeorm`
since it seems it was installed as a sibling dependency (see
10fcff9#diff-d57c900a61f2746ea3823bed028e1d81004e1e077149e4b4935269ffb39383e8)
which is also how the docs indicate it should be done (see
https://docs.nestjs.com/techniques/database).
Nest was failing to build since `HandlebarsAdapter` is no longer
exported from the same module. The import was updated as per the current
docs: https://nest-modules.github.io/mailer/docs/mailer

`handlebars` was also added as a peer dependency since the docs said it
should be installed if it is used (there was also a warning about this).
When moving to 4.6.1+ an error is thrown at runtime when we try to list
projects:

server_1    | QueryFailedError: column Project.undefined does not exist

This is related to the filtering of the project controller. In looking
at the WHERE condition in the query to fetch the projects we can see
where the query is being built incorrectly (a column
`"Project"."undefined"` is referenced):

server_1    | query failed: SELECT "Project"."id" AS "Project_id",
"Project"."name" AS "Project_name", "Project"."number_of_districts" AS

...

"regionConfig"."id"="Project"."region_config_id"  INNER JOIN "user"
"project_user" ON "project_user"."id"="Project"."user_id" WHERE
("Project"."undefined" = $1) ORDER BY "Project"."updated_dt" DESC --
PARAMETERS: ["07f9966f-facf-42ce-a4ee-48320007f1cc"]

It seems like this should work fine since `user_id` is indeed a column
on the project.

An issue was created for this here:
nestjsx/crud#684
This makes it so that all deps which can be upgraded are upgraded.

`class-transformer` had to be held back because upgrading it caused
`@nestjsx/crud-typeorm` to throw an error since it seems to depend on an
older version.
@pcaisse pcaisse requested a review from maurizi March 19, 2021 20:21
@pcaisse pcaisse force-pushed the feature/pc/update-nest-deps branch from 636b832 to 72dd828 Compare March 19, 2021 20:23
Copy link
Contributor

@maurizi maurizi left a comment

Choose a reason for hiding this comment

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

Working great 👍

@pcaisse pcaisse merged commit 32cbc74 into develop Mar 23, 2021
@pcaisse pcaisse deleted the feature/pc/update-nest-deps branch March 23, 2021 14:10
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.

Upgrade Nest.js and related dependencies
2 participants