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

TypeError: loggerEnvConfig.levels.split is not a function #12339

Closed
3 tasks done
abdonrd opened this issue Mar 23, 2022 · 4 comments · Fixed by #12342
Closed
3 tasks done

TypeError: loggerEnvConfig.levels.split is not a function #12339

abdonrd opened this issue Mar 23, 2022 · 4 comments · Fixed by #12342
Labels

Comments

@abdonrd
Copy link
Contributor

abdonrd commented Mar 23, 2022

Preflight Checklist

Describe the Bug

After update from Directus v9.7.0 to v9.7.1...

We have this error:

/node_modules/directus/dist/logger.js:46
    for (const el of loggerEnvConfig.levels.split(',')) {
                                            ^

TypeError: loggerEnvConfig.levels.split is not a function or its return value is not iterable

To Reproduce

We have this config:

LOG_STYLE="raw"
LOGGER_LEVELS="trace:DEBUG,debug:DEBUG,info:INFO,warn:WARNING,error:ERROR,fatal:CRITICAL"
LOGGER_MESSAGE_KEY="message"

And just update from Directus v9.7.0 to v9.7.1 and run:

npx directus start

Errors Shown

/node_modules/directus/dist/logger.js:46
    for (const el of loggerEnvConfig.levels.split(',')) {
                                            ^

TypeError: loggerEnvConfig.levels.split is not a function or its return value is not iterable

What version of Directus are you using?

9.7.1

What version of Node.js are you using?

16

What database are you using?

Postgres 14

What browser are you using?

Chrome

What operating system are you using?

macOS Monterey (12)

How are you deploying Directus?

Running locally

@abdonrd
Copy link
Contributor Author

abdonrd commented Mar 23, 2022

Here:

for (const el of loggerEnvConfig.levels.split(',')) {

Looks like loggerEnvConfig.levels is an array in the v9.7.1:

[
  'trace:DEBUG',
  'debug:DEBUG',
  'info:INFO',
  'warn:WARNING',
  'error:ERROR',
  'fatal:CRITICAL'
]

And a string in the v9.7.0:

trace:DEBUG,debug:DEBUG,info:INFO,warn:WARNING,error:ERROR,fatal:CRITICAL

@azrikahar
Copy link
Contributor

Thanks for confirming the difference between 9.7.1 and 9.7.0. It should be due to #12330, which actually is correcting it! It should have been an array from the get go, rather than a string.

@azrikahar
Copy link
Contributor

azrikahar commented Mar 24, 2022

Just to offer a workaround while the fix get released in a future version, you should be able to temporarily force it as a string by doing LOGGER_LEVELS="string:trace:DEBUG,debug:DEBUG,info:INFO,warn:WARNING,error:ERROR,fatal:CRITICAL" (note the string: prefix in front). Tested that on 9.7.1 and it works on my end. Hope that helps! 👍

@abdonrd
Copy link
Contributor Author

abdonrd commented Mar 24, 2022

Thanks @azrikahar!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants