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

order-confirmation email generation seems to be broken in devMode #771

Closed
Tyratox opened this issue Mar 17, 2021 · 0 comments
Closed

order-confirmation email generation seems to be broken in devMode #771

Tyratox opened this issue Mar 17, 2021 · 0 comments
Assignees
Labels

Comments

@Tyratox
Copy link
Contributor

Tyratox commented Mar 17, 2021

Describe the bug
In the latest beta email generation for orders seems to be broken inside the mailbox. In the console the following error is logged:

[run:server] error  [EmailPlugin] shippingLine.discounts is not iterable
[run:server] TypeError: shippingLine.discounts is not iterable
[run:server]     at Order.get discounts [as discounts] (node_modules/@vendure/core/src/entity/order/order.entity.ts:126:49)
[run:server]     at Job.ensureDataIsSerializable (node_modules/@vendure/core/src/job-queue/job.ts:226:53)
[run:server]     at Job.ensureDataIsSerializable (node_modules/@vendure/core/src/job-queue/job.ts:219:36)
[run:server]     at Job.ensureDataIsSerializable (node_modules/@vendure/core/src/job-queue/job.ts:219:36)
[run:server]     at new Job (node_modules/@vendure/core/src/job-queue/job.ts:104:27)
[run:server]     at JobQueue.add (node_modules/@vendure/core/src/job-queue/job-queue.ts:59:21)
[run:server]     at EmailPlugin.handleEvent (node_modules/@vendure/email-plugin/src/plugin.ts:247:37)
[run:server]     at processTicksAndRejections (internal/process/task_queues.js:97:5)
[run:server]     at node_modules/@vendure/email-plugin/src/dev-mailbox.ts:44:21

To Reproduce
Steps to reproduce the behavior:

  1. Install a new vendure instance
  2. npm start
  3. open http://localhost:3000/mailbox
  4. Select "order-confirmation" and press "GENERATE TEST"

Expected behavior
No error.

Environment (please complete the following information):

  • @vendure/core version: 1.0.0-beta.3
  • Nodejs version: v15.10.0
  • Database (mysql/postgres etc): mysql

Additional context
The issue seems to come from line 226 in job.ts.

if (isClassInstance(data)) {
const descriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf(data));
for (const name of Object.keys(descriptors)) {
const descriptor = descriptors[name];
if (typeof descriptor.get === 'function') {
output[name] = (data as any)[name];
}
}
}

EDIT:

I can imagine that this issue is related to the mock event data as order emails are generated without any issues if the event isn't triggered from the mailbox.
I've discovered this issue only because in one environment an old node version (12) was installed and there email generation seemed to be totally broken. (No mails generating, no errors logged) But these issues were all resolved as soon as I updated node. I just wanted to mention this here in case someone searches for an existing issue.

@Tyratox Tyratox added the type: bug 🐛 Something isn't working label Mar 17, 2021
@Tyratox Tyratox changed the title order-confirmation email generation seems to be broken order-confirmation email generation seems to be broken in devMode Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants