mirego/accent

500 Error on new strings after configuring machine translations after sync

Closed this issue · 2 comments

I've configured machine translations by creating a SA in a GCP project and giving the SA the Cloud Translation API Service Agent IAM role. I've created a key in JSON format and copy and paste the contents of the download json key here:

Screenshot 2023-11-02 at 18 13 38

I've marked the Automatically run on project sync checkbox, and after syncing with a new key I've started receiving 500 errors when going to the detail of a key on the dashboard.

When I've checked the logs, I've found the following error, not sure what is creating this issue.

2023-11-02T17:08:35.201934+00:00 app[web.1]: 17:08:35.201 [error] #PID<0.14320.0> running Accent.Endpoint (connection #PID<0.14318.0>, stream id 1) terminated
2023-11-02T17:08:35.201939+00:00 app[web.1]: Request: POST /graphql
2023-11-02T17:08:35.201939+00:00 app[web.1]: ** (exit) an exception was raised:
2023-11-02T17:08:35.201940+00:00 app[web.1]:     ** (FunctionClauseError) no function clause matching in String.replace/4
2023-11-02T17:08:35.201940+00:00 app[web.1]:         (elixir 1.14.3) lib/string.ex:1521: String.replace(nil, "  ", " ", [])
2023-11-02T17:08:35.201956+00:00 app[web.1]:         (accent 1.18.4) lib/lint/checks/double_spaces.ex:9: Accent.Lint.Checks.DoubleSpace.check/1
2023-11-02T17:08:35.201956+00:00 app[web.1]:         (accent 1.18.4) lib/lint/lint.ex:36: anonymous fn/2 in Accent.Lint.entry_to_messages/1
2023-11-02T17:08:35.201957+00:00 app[web.1]:         (elixir 1.14.3) lib/enum.ex:4249: Enum.flat_map_list/2
2023-11-02T17:08:35.201957+00:00 app[web.1]:         (accent 1.18.4) lib/lint/lint.ex:35: Accent.Lint.entry_to_messages/1
2023-11-02T17:08:35.201957+00:00 app[web.1]:         (elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
2023-11-02T17:08:35.201958+00:00 app[web.1]:         (accent 1.18.4) lib/graphql/resolvers/lint.ex:34: Accent.GraphQL.Resolvers.Lint.lint_batched_translation/3
2023-11-02T17:08:35.201958+00:00 app[web.1]:         (absinthe 1.7.5) lib/absinthe/middleware/batch.ex:124: Absinthe.Middleware.Batch.call/2

Fixed in latest (v1.19.5), we now prevent crashing in linting for "nil" value

Cool thanks!