column "scopes" does not exist
という奇妙な問題が発生しました。ここではサーバーで発生したログはありますが、ローカル環境ではありません。Loopback 3.8.0を使用しているときに「スコープ」の列が存在しません
Unhandled error for request GET /api/continents?access_token=aaaaaaaaaaabbbbbbbbbbbbbbbbL1AwzSoH8eHXwPdjzQATRXqto3lngEokVxR2j: error: column "scopes" does not exist
2017-05-05T04:35:06.642201+00:00 app[web.1]: at Connection.parseE (/app/node_modules/pg/lib/connection.js:569:11)
2017-05-05T04:35:06.642202+00:00 app[web.1]: at Connection.parseMessage (/app/node_modules/pg/lib/connection.js:396:17)
2017-05-05T04:35:06.642203+00:00 app[web.1]: at TLSSocket.<anonymous> (/app/node_modules/pg/lib/connection.js:132:22)
2017-05-05T04:35:06.642204+00:00 app[web.1]: at emitOne (events.js:96:13)
2017-05-05T04:35:06.642209+00:00 app[web.1]: at TLSSocket.emit (events.js:188:7)
2017-05-05T04:35:06.642210+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:176:18)
2017-05-05T04:35:06.642210+00:00 app[web.1]: at TLSSocket.Readable.push (_stream_readable.js:134:10)
2017-05-05T04:35:06.642211+00:00 app[web.1]: at TLSWrap.onread (net.js:547:20)
同じ理由でアクセストークンを含むすべてのAPIが失敗しました。アクセストークンが設定されていない場合、APIは正常に動作します(公開の場合はデータがあり、認証が必要な場合は401/403が取得されます)。
私はローカルで試してみました。それは動作しましたが、私はheroku local
を試しました。長いテストの後、私の違いは、私のローカルとheroku local
は、私のサーバーが3.8.0を実行している間にループバックバージョン3.4.0を実行していることがわかりました。
3.4.0を使用するようにサーバーを強制した後は正常です。
ループバック3.4.0:
"name": "AccessToken",
"properties": {
"id": { "type": "string", "id": true },
"ttl": { "type": "number", "ttl": true, "default": 1209600, "description": "time to live in seconds (2 weeks by default)" },
"created": { "type": "Date", "defaultFn": "now" }
},
ループバック3.8.0:
"name": "AccessToken",
"properties": {
"id": { "type": "string", "id": true },
"ttl": { "type": "number", "ttl": true, "default": 1209600, "description": "time to live in seconds (2 weeks by default)" },
"scopes": {
"type": ["string"],
"description": "Array of scopes granted to this access token."
},
"created": { "type": "Date", "defaultFn": "now" }
},
以来
/node_modules/loopback/common/models/access-token.json
に掘り、ここでは3.4.0と3.8.0の違いは私はnode_modulesをチェックインしていませんでしたが、どのようにして問題を解決できるか知っていますか?