Skip to content

'use strict' breaks supports for db connectors in lib/applications.js #2978

Closed

Description

@ebarault

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

Adding 'use strict' in lib/application.js on recent code style review broke the support for db connectors here : https://github.com/strongloop/loopback/blob/master/lib/application.js#L427

Link to sample repo to reproduce issue (if bug)

any loopback example app, just npm install a db connector (e.g. mongodb) and change the db in datasources.json to be a db of that kind

{
	"db": {
		"name": "db",
		"connector": "mongodb",
		"host": "localhost",
		"port": 27017,
		"database": "loopback"
	}
}

Expected result

no error

Actual result (if bug)

/Users/Eric/carbip/loopback_tests/loopback-example-access-control/node_modules/loopback/lib/application.js:237
    throw err;
    ^

TypeError: Cannot create data source "db": Cannot create property 'name' on string 'mongodb'
    at dataSourcesFromConfig (/Users/Eric/carbip/loopback_tests/loopback-example-access-control/node_modules/loopback/lib/application.js:427:29)

Additional information (Node.js version, LoopBack version, etc)

node v7
loopback v3 c3ab932

Activity

  1. self-assigned this
    on Nov 23, 2016
  2. loay commented on Nov 23, 2016

    @loay
    Contributor

    Thanks @ebarault Looking into your PR as well.

  3. loay commented on Nov 30, 2016

    @loay
    Contributor

    PR is merged. Issue is fixed.

  4. reopened this on Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions