Skip to content

Instantly share code, notes, and snippets.

@raisedadead
Last active November 16, 2017 06:09
Show Gist options
  • Save raisedadead/22f7a38bb47204fded9b0877fde954ef to your computer and use it in GitHub Desktop.
Save raisedadead/22f7a38bb47204fded9b0877fde954ef to your computer and use it in GitHub Desktop.
Checklist to be followed for Loopback Migration to v3.

Checklist for Upgrade:

  • Update LoopBack version

    • Edit package.json
    • Update dependencies with npm
  • Update use of REST error handler

  • Replace LoopBack middleware “getter” properties NOT Required or Already in Compliance

  • Update models

    • Change use of PUT endpoints NOT Required or Already in Compliance
    • Remove use of undefined mixins NOT Required or Already in Compliance
    • Update remote method definitions
    • Remove dots from model property names
    • Rename models called “File” NOT Required or Already in Compliance
  • Update models derived from PersistedModel

    • Use forceId to explicitly set model IDs NOT Required or Already in Compliance
    • Revise use of PersistedModel.create() NOT Required or Already in Compliance
    • Remove check for ctx.instance in “loaded” operation hooks NOT Required or Already in Compliance
    • Replace removed PersistedModel event listeners NOT Required or Already in Compliance
    • Replace calls to PersistedModel.updateOrCreate() with array argument NOT Required or Already in Compliance
  • Explicitly add User model properties that were removed NOT Required or Already in Compliance

  • Check request parameter encoding

  • Remove use of current-context methods, middleware, and configuration settings

    • note this throws errors like so:
    Error: Unknown "flyer" id "undefined".
      at Function.convertNullToNotFoundError (/Users/raisedadead/DEV/freeCodeCamp/node_modules/loopback/lib/persisted-model.js:89:17)
      at invokeRestAfter (/Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/lib/rest-adapter.js:472:25)
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:3686:9
      at replenish (/Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:881:17)
      at iterateeCallback (/Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:866:17)
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:843:16
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:3691:13
      at apply (/Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:21:25)
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/async/dist/async.js:56:12
      at interceptInvocationErrors (/Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/lib/remote-objects.js:685:22)
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
      at /Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/node_modules/loopback-phase/node_modules/async/lib/async.js:154:25
      at execStack (/Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/lib/remote-objects.js:494:7)
      at RemoteObjects.execHooks (/Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/lib/remote-objects.js:498:10)
      at phaseAfterInvoke (/Users/raisedadead/DEV/freeCodeCamp/node_modules/strong-remoting/lib/remote-objects.js:656:10)
  • Update use of promises Fixed by freeCodeCamp/freeCodeCamp#15628

  • Check CORS configuration

@raisedadead
Copy link
Author

raisedadead commented Jun 3, 2017

We have a long known issue where the email is not unique and @QuincyLarson has seen this in duplicate account support emails. Well the reason is most probably this:

strongloop/loopback#1137 (comment)

Which is introduced here:
https://github.com/freeCodeCamp/freeCodeCamp/blob/staging/common/models/user.js#L36-L40

  // NOTE(berks): user email validation currently not needed but build in. This
  // work around should let us sneak by
  // see:
  // https://github.com/strongloop/loopback/issues/1137#issuecomment-109200135
  delete User.validations.email;

Update:
We aim to fix this by: freeCodeCamp/freeCodeCamp#15205

Update:
We aim to fix this by: freeCodeCamp/freeCodeCamp#15985

@raisedadead
Copy link
Author

raisedadead commented Jun 4, 2017

There is an exception thrown when we try and send a welcome email, but I have also checked that this is easily resolved by: freeCodeCamp/freeCodeCamp#9660

Update:
Thanks to @BerkeleyTrue it's now known that this was due to LB's implementation of promises. And this is now fixed by:
freeCodeCamp/freeCodeCamp#15628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment