Skip to content

Commit 554ccbd

Browse files
authored
Merge pull request #2721 from strongloop/docs/context-upgrade-2x-3x
Add instructions for upgrading context
2 parents da09876 + 94f9a1b commit 554ccbd

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

3.0-RELEASE-NOTES.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,38 @@ We have removed the following current-context-related APIs:
162162
- `loopback.createContext`
163163
- `loopback.runInContext`
164164
165-
Additionaly, `loopback#context` middleware and `remoting.context` server
165+
Additionally, `loopback#context` middleware and `remoting.context` server
166166
config were removed too.
167167
168+
#### Upgrading from 2.x to 3.x
169+
170+
When upgrading from LoopBack 2.x, you need to disable or remove
171+
`remoting.context` configuration in your server config.
172+
173+
```js
174+
{
175+
"remoting": {
176+
"context": false, // or remove completely
177+
// etc.
178+
},
179+
// etc.
180+
}
181+
```
182+
183+
Without this change, you will see the following error on the first HTTP request
184+
received:
185+
186+
```
187+
Unhandled error for request GET /api/Users:
188+
Error: remoting.context option was removed in version 3.0.
189+
See https://docs.strongloop.com/display/APIC/Using%20current%20context for more
190+
details.
191+
at restApiHandler (.../node_modules/loopback/server/middleware/rest.js:44:15)
192+
at Layer.handle [as handle_request] (.../node_modules/express/lib/router/layer.js:95:5)
193+
```
194+
195+
#### Setting up "current context" in 3.x
196+
168197
To setup "current context" feature in your LoopBack 3.x application, you
169198
should use [loopback-context](https://www.npmjs.com/package/loopback-context)
170199
module:

0 commit comments

Comments
 (0)