raisedadead
5/28/2017 - 7:41 PM

Checklist to be followed for Loopback Migration to v3.

Checklist to be followed for Loopback Migration to v3.

Reference: https://loopback.io/doc/en/lb3/Migrating-to-3.0.html

PR: https://github.com/freeCodeCamp/freeCodeCamp/pull/15892

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 https://github.com/freeCodeCamp/freeCodeCamp/pull/15628

  • Check CORS configuration