Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NODE_CONFIG_DIR issue]Wrong return files in config.js #731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MrFiregore
Copy link

I am getting the following error:

TypeError: Cannot read properties of undefined (reading 'sort') at Config.util.locateMatchingFiles (E:\wamp64\www\configtest\node_modules\.pnpm\config@3.3.9\node_modules\config\lib\config.js:741:5

This happens when you configure only one dir in NODE_CONFIG_DIR:

process.env["NODE_CONFIG_DIR"] = path.resolve(__dirname,`../environments/${env}`)+path.delimiter;

Swap this line for line 741 to solve the issue:

return files;

I am getting the following error:


```bash
TypeError: Cannot read properties of undefined (reading 'sort') at Config.util.locateMatchingFiles (E:\wamp64\www\configtest\node_modules\.pnpm\config@3.3.9\node_modules\config\lib\config.js:741:5
```

Swap this line for line 741 to solve the issue:

https://github.com/node-config/node-config/blob/46d0c31c4a14e38c115b3eb8807c880d9d1b5f0e/lib/config.js#L740
@MrFiregore MrFiregore changed the title Wrong return files in config.js **[NODE_CONFIG_DIR issue]** Wrong return files in config.js Apr 5, 2023
@MrFiregore MrFiregore changed the title **[NODE_CONFIG_DIR issue]** Wrong return files in config.js [NODE_CONFIG_DIR issue]Wrong return files in config.js Apr 5, 2023
@jdmarshall
Copy link
Contributor

This could use a test

@markstos
Copy link
Collaborator

markstos commented Aug 4, 2023

@jdmarshall Is right. I won't consider this for merging without test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants