Closed Douglas-Pontes closed 10 months ago
The gift card service was missing from the ses class constructor. It has been fixed in development, but not officially released yet because the changes for the new version are extensive and still in testing.
Could I get you to try updating to version "3.0.1-canary.5" to see if that resolved the issue?
With the new version, you don't need to specify all the templates in your config. Just specify your template and partials folders. The templates must be named according to the default names to be recognized. But the major benefit is that now a LOT more events are enabled for notifications by default, if a valid template is present.
Now we have the gift card service, but Im creating an gift card without an order related, so order is coming null, but in your code at ses.js:71 the email is required, but in this case you should be getting the email at metadata, like I believe we will only have an order related if someone uses the gift card right?
With the new version, you don't need to specify all the templates in your config. Just specify your template and partials folders. The templates must be named according to the default names to be recognized. But the major benefit is that now a LOT more events are enabled for notifications by default, if a valid template is present.
Thats great nice job
I think I know how to fix it. I'll let you know when I post a new canary version.
Actually I configured your plugin and the first event I tried to test was gift card, from what I understood medusa only sends an email when you create a custom gift card which you send to an specific email, which later when customer uses the gift card it will be checked if the customer has the same email, in this case at notification-data at line 93 you should get the email from metadata which will be the email you want to send the gift card to and also order can will be null at the time the email is sent
But I'm very new to medusa aswell, I can be wrong
I just published 3.0.1-canary.6. Could you try it and see if it resolves your error?
not yet, you fixed the problem of email, but now its not finding the template I debbuged with console.log
for some reason in the templatePath we have node_modules before /data/templates in my project thats wrong
SES_TEMPLATE_PATH="data/templates"
If I change the template path to be the whole path it works I got the email! SES_TEMPLATE_PATH="/Users/douglas/Desktop/PmdTech Solutions/ecommerce/my-medusa-store/data/templates"
but you should fix that because in production thats bad
Hmm, this is a strange one. Nothing about the template path was changed.
When I develop locally and use yarn link to install or install from a local folder, I have to use the full path (because of sym-linking weirdness. But when I install from npm, I can use the relative path. I'm not sure what might be causing this for you.
I will definitely test it more before 3.0 goes live.
Yeah me neither, I'll test all the events, and I'll keep opening issues if I find something else okay? for now I'll use .6 version and the whole path
Ah, I think I might know what has happened. Thank you so much for surfacing this.
With 3.0, it was converted to typescript. As part of that, the build process was changed to put everything in the plugin's 'dist' folder instead of the top level folder like it was before. This extra level is causing the issue. I will fix it.
Ah, I think I might know what has happened. Thank you so much for surfacing this.
With 3.0, it was converted to typescript. As part of that, the build process was changed to put everything in the 'dist' folder instead of the top level folder like it was before. This extra level is causing the issue. I will fix it.
Oh yeah, thats it, well done!!
So I'll get back with other issues if I find more okay? thank you for the quick answers, I hope I can help you more
I just pushed 3.0.1-canary.7
Nice @pevey It working with data/templates
Thanky youu
When I test to send the email via postman It works like a charm, but when I go to the admin dashboard and create a gift card it tries to send the email but I get this problem Cannot read properties of undefined (reading 'retrieve') at ses.js file on line 589 const giftCard = await this.giftCardService.retrieve(id, {, that means this.giftCardService is undefined. I console log the id and its right, I think the problem is the dependency injection of this service