-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
🐛 Fixed newsletter not sending if locale is invalid #21573
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
closes: https://linear.app/ghost/issue/ENG-1752 ref https://github.com/moment/luxon/blob/master/docs/intl.md - We noticed the following error trace: RangeError: Incorrect locale information provided at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32) at new DateTimeFormat (<anonymous>) at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11) at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16) at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12) at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21) at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17) at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78) at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74) at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36 at Array.map (<anonymous>) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54 at Array.map (<anonymous>) at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24) at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33) at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51) - This is due to the locale being user-input - it can be set to any string. - In our email sending code we pass the string to luxon to format dates, which errors if the locale is not valid according it Intl. - This fix ensures that the locale is valid before passing it to luxon, falling back to en-gb if the locale is not valid
ErisDS
force-pushed
the
locale-email-fix
branch
from
November 7, 2024 21:34
d63e5f6
to
5d3957f
Compare
9larsons
pushed a commit
that referenced
this pull request
Nov 7, 2024
ref https://github.com/moment/luxon/blob/master/docs/intl.md - We noticed the following error trace: RangeError: Incorrect locale information provided at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32) at new DateTimeFormat (<anonymous>) at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11) at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16) at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12) at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21) at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17) at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78) at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74) at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36 at Array.map (<anonymous>) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54 at Array.map (<anonymous>) at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24) at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33) at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51) - This is due to the locale being user-input - it can be set to any string. - In our email sending code we pass the string to luxon to format dates, which errors if the locale is not valid according it Intl. - This fix ensures that the locale is valid before passing it to luxon, falling back to en-gb if the locale is not valid
ErisDS
added a commit
that referenced
this pull request
Nov 7, 2024
ref #21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
9larsons
pushed a commit
that referenced
this pull request
Nov 7, 2024
ref https://github.com/moment/luxon/blob/master/docs/intl.md - We noticed the following error trace: RangeError: Incorrect locale information provided at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32) at new DateTimeFormat (<anonymous>) at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11) at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16) at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12) at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21) at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17) at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78) at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74) at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36 at Array.map (<anonymous>) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54 at Array.map (<anonymous>) at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24) at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33) at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51) - This is due to the locale being user-input - it can be set to any string. - In our email sending code we pass the string to luxon to format dates, which errors if the locale is not valid according it Intl. - This fix ensures that the locale is valid before passing it to luxon, falling back to en-gb if the locale is not valid
9larsons
pushed a commit
that referenced
this pull request
Nov 7, 2024
ref #21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
9larsons
pushed a commit
that referenced
this pull request
Nov 7, 2024
ref #21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
9larsons
pushed a commit
that referenced
this pull request
Nov 7, 2024
ref #21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
9larsons
pushed a commit
that referenced
this pull request
Nov 13, 2024
ref https://github.com/moment/luxon/blob/master/docs/intl.md - We noticed the following error trace: RangeError: Incorrect locale information provided at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32) at new DateTimeFormat (<anonymous>) at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11) at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16) at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12) at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21) at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17) at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78) at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74) at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36 at Array.map (<anonymous>) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54 at Array.map (<anonymous>) at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24) at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33) at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51) - This is due to the locale being user-input - it can be set to any string. - In our email sending code we pass the string to luxon to format dates, which errors if the locale is not valid according it Intl. - This fix ensures that the locale is valid before passing it to luxon, falling back to en-gb if the locale is not valid
9larsons
pushed a commit
that referenced
this pull request
Nov 13, 2024
ref #21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
tilak999
pushed a commit
to tilak999/ghost
that referenced
this pull request
Nov 20, 2024
ref https://github.com/moment/luxon/blob/master/docs/intl.md - We noticed the following error trace: RangeError: Incorrect locale information provided at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32) at new DateTimeFormat (<anonymous>) at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11) at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16) at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12) at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21) at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17) at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78) at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74) at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36 at Array.map (<anonymous>) at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54 at Array.map (<anonymous>) at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24) at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33) at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51) - This is due to the locale being user-input - it can be set to any string. - In our email sending code we pass the string to luxon to format dates, which errors if the locale is not valid according it Intl. - This fix ensures that the locale is valid before passing it to luxon, falling back to en-gb if the locale is not valid
tilak999
pushed a commit
to tilak999/ghost
that referenced
this pull request
Nov 20, 2024
ref TryGhost#21573 - We discussed this, and figured we should get this behind the flag for now, even though it's pulled - This gives us the ability to do a fast revert if we have to later, which is the point of having the labs "GA FEATURES" array - Note this removes the labsEnabled variable in the tests to make it clearer if the flag is off or on (it was off!)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ref https://github.com/moment/luxon/blob/master/docs/intl.md
at BatchSendingService.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:639:32)
at new DateTimeFormat ()
at getCachedDTF (/home/ghost/node_modules/luxon/build/node/luxon.js:621:11)
at new PolyDateFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:842:16)
at Locale.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:1066:12)
at Formatter.dtFormatter (/home/ghost/node_modules/luxon/build/node/luxon.js:2274:21)
at Formatter.formatDateTime (/home/ghost/node_modules/luxon/build/node/luxon.js:2280:17)
at DateTime.toLocaleString (/home/ghost/node_modules/luxon/build/node/luxon.js:6893:78)
at formatDateLong (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:45:74)
at Object.getValue (/home/ghost/node_modules/@tryghost/email-service/lib/EmailRenderer.js:683:47)
at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:158:36
at Array.map ()
at /home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:154:54
at Array.map ()
at SendingService.buildRecipients (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:151:24)
at SendingService.send (/home/ghost/node_modules/@tryghost/email-service/lib/SendingService.js:127:33)
at response.retryDb (/home/ghost/node_modules/@tryghost/email-service/lib/BatchSendingService.js:451:51)