Closed mdbetancourt closed 3 years ago
rest-builder.js line 84, setting to true solved it for me
mime.define({ 'application/x-www-form-urlencoded': ['form', 'urlencoded', 'form-body'], }, true);
@mdbetancourt How do you reproduce the error?
works well with @loopback/testlab: 3.2.9
Several years later, this exact issue is happening to me right now.
It's my first time using loopback and I've setup everything today using lb4 app
.
When running yarn run test
, I get the error:
3) PingController
"before all" hook: setupApplication for "invokes GET /ping":
Error: Attempt to change mapping for "form" extension from "application/x-www-form-urlencoded" to "application/x-www-form-urlencoded". Pass `force=true` to allow this, otherwise remove "form" from the list of extensions for "application/x-www-form-urlencoded".
at Mime.define (node_modules\mime\Mime.js:56:15)
at Object.<anonymous> (node_modules\loopback-connector-rest\lib\rest-builder.js:84:6)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (node_modules\loopback-connector-rest\index.js:8:18)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at tryModules (node_modules\loopback-datasource-juggler\lib\datasource.js:260:13)
at Function.DataSource._resolveConnector (node_modules\loopback-datasource-juggler\lib\datasource.js:288:21)
at AdventureLandDataSource.DataSource.setup (node_modules\loopback-datasource-juggler\lib\datasource.js:462:31)
at new DataSource (node_modules\loopback-datasource-juggler\lib\datasource.js:147:8)
at new AdventureLandDataSource (src\datasources\adventure-land.datasource.ts:45:5)
at C:\Users\Telokis\Documents\Dev\Git\teloalapi\node_modules\@loopback\context\src\resolver.ts:76:14
at transformValueOrPromise (node_modules\@loopback\context\src\value-promise.ts:298:12)
at instantiateClass (node_modules\@loopback\context\src\resolver.ts:69:58)
at C:\Users\Telokis\Documents\Dev\Git\teloalapi\node_modules\@loopback\context\src\binding.ts:886:37
at Binding._getValue (node_modules\@loopback\context\src\binding.ts:724:14)
at C:\Users\Telokis\Documents\Dev\Git\teloalapi\node_modules\@loopback\context\src\binding.ts:548:23
at C:\Users\Telokis\Documents\Dev\Git\teloalapi\node_modules\@loopback\context\src\resolution-session.ts:109:13
at tryCatchFinally (node_modules\@loopback\context\src\value-promise.ts:222:14)
at tryWithFinally (node_modules\@loopback\context\src\value-promise.ts:197:10)
at Function.runWithBinding (node_modules\@loopback\context\src\resolution-session.ts:108:26)
at Binding.getValue (node_modules\@loopback\context\src\binding.ts:538:40)
at C:\Users\Telokis\Documents\Dev\Git\teloalapi\node_modules\@loopback\context\src\context-view.ts:211:16
at resolveList (node_modules\@loopback\context\src\value-promise.ts:169:28)
at ContextView.resolve (node_modules\@loopback\context\src\context-view.ts:202:29)
at ContextView.values (node_modules\@loopback\context\src\context-view.ts:240:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at LifeCycleObserverRegistry.notifyGroups (node_modules\@loopback\core\src\lifecycle-registry.ts:209:23)
at LifeCycleObserverRegistry.init (node_modules\@loopback\core\src\lifecycle-registry.ts:247:5)
at TeloALApi.init (node_modules\@loopback\core\src\application.ts:318:5)
at TeloALApi.start (node_modules\@loopback\core\src\application.ts:356:29)
at TeloALApi.start (node_modules\@loopback\boot\src\mixins\boot.mixin.ts:76:7)
at setupApplication (src\__tests__\acceptance\test-helper.ts:18:3)
at Context.<anonymous> (src\__tests__\acceptance\ping.controller.acceptance.ts:10:24)
This is the default test, I haven't altered it yet. When looking at the specified line, I can indeed see the missing true
specified above.
I am using node v18.16.1
.
after upgrade from testlab@3.2.5 to testlab@3.2.7 i get the following error
Error: Attempt to change mapping for "form" extension from "application/x-www-form-urlencoded" to "application/x-www-form-urlencoded". Pass
force=true
to allow this, otherwise remove "form" from the list of extensions for "application/x-www-form-urlencoded"may be related to https://github.com/visionmedia/superagent/issues/1288
dep changes between versions