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

i18n error: path "errors.models.posts.postNotFound" was not found #9519

Closed
mertcangokgoz opened this issue Mar 20, 2018 · 20 comments
Closed
Assignees
Labels
needs:info [triage] Blocked on missing information

Comments

@mertcangokgoz
Copy link

I'm getting the following error when adding and deleting content

Technical details:

  • Ghost Version: 1.21.6
  • Node Version: 6.9
  • Browser/OS: Chrome
  • Database: SQLite
{
   "name":"Log",
   "hostname":"Site",
   "pid":25551,
   "level":50,
   "err":{
      "id":"b76e1d90-2c6b-11e8-8595-99a5c9cf6e1c",
      "domain":"https://mertcangokgoz.com/",
      "code":null,
      "name":"IncorrectUsageError",
      "statusCode":400,
      "level":"critical",
      "message":"i18n error: path \"errors.models.posts.postNotFound\" was not found",
      "stack":"IncorrectUsageError: i18n error: path \"errors.models.posts.postNotFound\" was not found\n    at new IncorrectUsageError (/var/www/ghost/versions/1.21.6/node_modules/ghost-ignition/lib/errors/index.js:79:23)\n    at Object.findString (/var/www/ghost/versions/1.21.6/core/server/lib/common/i18n.js:152:31)\n    at Object.t (/var/www/ghost/versions/1.21.6/core/server/lib/common/i18n.js:66:23)\n    at Child.then (/var/www/ghost/versions/1.21.6/core/server/models/post.js:690:50)\n    at Child.tryCatcher (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/promise.js:512:31)\n    at Promise._settlePromise (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/promise.js:569:18)\n    at Promise._settlePromise0 (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/promise.js:614:10)\n    at Promise._settlePromises (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/promise.js:693:18)\n    at Async._drainQueue (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/async.js:133:16)\n    at Async._drainQueues (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/async.js:143:10)\n    at Immediate.Async.drainQueues (/var/www/ghost/versions/1.21.6/node_modules/bluebird/js/release/async.js:17:14)\n    at runCallback (timers.js:794:20)\n    at tryOnImmediate (timers.js:752:5)\n    at processImmediate [as _immediateCallback] (timers.js:729:5)"
   },
   "msg":"i18n error: path \"errors.models.posts.postNotFound\" was not found",
   "time":"2018-03-20T18:22:58.547Z",
   "v":0
}
@kirrg001
Copy link
Contributor

kirrg001 commented Mar 21, 2018

Hey!

Thanks for your report.

errors.models.posts.postNotFound

Indeed the key does not exist, it must be errors.models.post.postNotFound.

But, this should not cause your problem, because the i18n library falls back to a valid key.

I can't reproduce what you are reporting. The error is only thrown if you are trying to edit an existing post which does not exist in the database. Are using a special setup or a custom client?

@kirrg001 kirrg001 added the needs:info [triage] Blocked on missing information label Mar 21, 2018
@kirrg001 kirrg001 self-assigned this Mar 21, 2018
kirrg001 added a commit that referenced this issue Mar 21, 2018
refs #9519

- `errors.models.posts.postNotFound` -> wrong
- `errors.models.post.postNotFound`  -> correct
- the i18n lib just logs the error and falls back to a valid error key
- wrong i18n keys will never break Ghost
@mertcangokgoz
Copy link
Author

I did not do a special installation, re-install with this error. met again with the same error.

@kirrg001
Copy link
Contributor

@mertcangokgoz Can you pls swing by our slack community? It's easier to figure this out in a chat. We can leave this issue open till we know what causes your problem.

@mertcangokgoz
Copy link
Author

@kirrg001 I tried node version 8.9, so maybe it will not give an error. but it still gives an error, Nothing changed

note: im coming slack

@ErisDS
Copy link
Member

ErisDS commented Mar 21, 2018

@kirrg001 I threw together something to look for other translation strings that don't exist:

Assumed to be run from the root of the repo, it does take a little while - maybe 30secs:

grep -rhoE --include=\*.js "i18n\.t\('([^']+)'" . | sed -e "s/i18n.t(//" | sed -e "s/'//g" | xargs -L1 -I % sh -c "cat core/server/translations/en.json | jq 'if (.% | length) > 0 then empty else \".%\" end'"

Current output:

jq: error: syntax error, unexpected '|', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
if (.errors.api. | length) > 0 then empty else ".errors.api." end
jq: 1 compile error
jq: error: syntax error, unexpected '|', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
if (.errors.api. | length) > 0 then empty else ".errors.api." end
jq: 1 compile error
".errors.api.themes.invalidRequest"
jq: error: syntax error, unexpected '|', expecting FORMAT or QQSTRING_START (Unix shell quoting issues?) at <top-level>, line 1:
if (.notices.data.validation.index.validationFailedTypes. | length) > 0 then empty else ".notices.data.validation.index.validationFailedTypes." end
jq: 1 compile error
".warnings.helpers.get.mustBeCalledAsBlock"

The errors are from places where we use concatenation, and the key ends with a . E.g. i18n.t('.errors.api.' + ..... - you can ignore the errors, but it at least indicates the items we can't check this way.

The 2 keys that are output on their own are missing keys:

  • ".errors.api.themes.invalidRequest"
  • ".warnings.helpers.get.mustBeCalledAsBlock"

@kirrg001
Copy link
Contributor

@ErisDS Cool thanks 👍

...because the i18n library falls back to a valid key.

I will add them next Monday, it won't break anything.

@ErisDS
Copy link
Member

ErisDS commented Mar 21, 2018

I will add them next Monday, it won't break anything.

👍I know, just thought it would be useful to have a command to run to check this. Maybe wire it up as a grunt/yarn command 😬

@kirrg001
Copy link
Contributor

I know, just thought it would be useful to have a command to run to check this

Definitely. You are the queen of shell piping 🚬

@kirrg001
Copy link
Contributor

@mertcangokgoz Did you swing by our slack channel?

@mertcangokgoz
Copy link
Author

@kirrg001 I resolved the error, downgraded the nodejs(version 6.8)

@kirrg001
Copy link
Contributor

@mertcangokgoz You downgraded from 6.9 to 6.8?

@mertcangokgoz
Copy link
Author

@kirrg001 unfortunately yes, I have not been successful in latest versions

@kirrg001
Copy link
Contributor

That is weird. I'll do some more testing on Monday. If i can't reproduce, i have to close this issue. Thanks for coming back :) Very helpful

@kirrg001
Copy link
Contributor

@mertcangokgoz I wasn't able to reproduce. Do you have any more information? Steps to reproduce...?

@mertcangokgoz
Copy link
Author

Hi @kirrg001

explain the situation step by step

  1. created a virtual machine on Microsoft Azure
  2. I got the backups on the old machine
  3. installed ghost-cli and nodejs 6.13.1 on ubuntu 16 LTS
  4. created a ghost user
  5. I've completed the upload by document
  6. Set up my backup with ghost admin (exported data v1.21.5, imported to 1.21.6)
  7. The stories area started to 500 error and I could not update and delete it.

@kirrg001
Copy link
Contributor

kirrg001 commented Apr 2, 2018

@mertcangokgoz How did you install Ghost on Ubuntu? Did you follow our installation guide https://docs.ghost.org/docs/install?

@mertcangokgoz
Copy link
Author

@kirrg001

Yes, I used the official document.

@mertcangokgoz
Copy link
Author

Hello @kirrg001

I tried to use the newly released nodejs version 8.11.1, I finished the installation without a problem (Ghost 1.22.1 and Sqlite3) and works perfect

note: I still can not understand the cause of the problem.

@kirrg001
Copy link
Contributor

kirrg001 commented Apr 4, 2018

@mertcangokgoz Thanks for coming back. I wasn't able to reproduce this at all. Maybe it was a permission problem or a problem with the database.

If you encounter it again, please open a discussion in our forum 💫

@kirrg001 kirrg001 closed this as completed Apr 4, 2018
kirrg001 added a commit that referenced this issue Apr 18, 2018
@kirrg001
Copy link
Contributor

Pushed two broken i18n keys, see e43bdad.

Discovered by @ErisDS - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:info [triage] Blocked on missing information
Projects
None yet
Development

No branches or pull requests

3 participants