Closed aldo-roman closed 4 months ago
Hello team. Downgrading to 1.17 is also not possible for my use case. We need to send emails when an order is placed.
1.17.4 has a bug where promiseAll
util is not imported, thus the order subscriber fails.
This was fixed on #5635 and published on 1.19.x, but not back ported to 1.17.x where the bug was introduced.
I am now blocked to use the plugin in any version.
Please send help :pray:
Update: It actually works in 1.17! The promiseAll
error is still there, but the send grid listener gets fired properly and the emails are arriving. Still, this issue is blocking upgrade to 1.18+
Same issue
We have a pr open to upgrade the sendgrid plugin cc @olivermrbl
any updates on this? still not able to send emails using Sendgrid
ResponseError: Bad Request at node_modules/@sendgrid/client/src/classes/client.js:146:29 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 400, response: { headers: { server: 'nginx', date: 'Mon, 12 Feb 2024 08:48:48 GMT', 'content-type': 'application/json', 'content-length': '851', connection: 'keep-alive', 'access-control-allow-origin': 'https://sendgrid.api-docs.io', 'access-control-allow-methods': 'POST', 'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl', 'access-control-max-age': '600', 'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html', 'strict-transport-security': 'max-age=600; includeSubDomains' }, body: { errors: [Array] } } }
medusajs/medusa: 1.20 v medusajs/medusa-cli: 1.3.21 v
facing this error while using the sendGrid to send the order confirmation emails.
Also, pls provide the correct steps, In docs is somewhat, confusing, may be I missed something just to check with. Thanks! FYI: @olivermrbl
Shew its really harsh to complete an entire Medusa store from top to bottom, finally get to enabling sendgrid for email notifications, only to find that its broken 😭
Really hope this is resolved soon 🤞
Good luck devs! 🤜🤛
Im having trouble with this as well. Got Medusa v1.20.2, everything seems to be up-to-date and nothing works. Here's my package.json:
"dependencies": {
"@medusajs/admin": "7.1.11",
"@medusajs/cache-inmemory": "^1.8.9",
"@medusajs/cache-redis": "^1.8.9",
"@medusajs/event-bus-local": "^1.9.8",
"@medusajs/event-bus-redis": "^1.8.11",
"@medusajs/file-local": "^1.0.3",
"@medusajs/medusa": "1.20.2",
"@sendgrid/mail": "^8.1.1",
"@tanstack/react-query": "4.22.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "16.3.1",
"express": "^4.17.2",
"medusa-fulfillment-manual": "^1.1.39",
"medusa-interfaces": "^1.3.8",
"medusa-payment-manual": "^1.0.24",
"medusa-payment-stripe": "^6.0.7",
"medusa-plugin-mailchimp": "^1.1.50",
"medusa-plugin-sendgrid": "^1.3.12",
"prism-react-renderer": "^2.0.4",
"typeorm": "^0.3.16"
},
I also get the 'Processing order.placed which has 2 subscribers', as well as this log when hitting npx medusa develop to fire up the admin server:
_Initializing plugins warn: The subscriber in C:\Users\DenisFelst\silice\silice-admin0\node_modules\medusa-plugin-sendgrid\subscribers\order.js is missing a config. warn: The subscriber in C:\Users\DenisFelst\silice\silice-admin0\node_modules\medusa-plugin-sendgrid\subscribers\restock.js is missing a config. warn: The subscriber in C:\Users\DenisFelst\silice\silice-admin0\nodemodules\medusa-plugin-sendgrid\subscribers\user.js is missing a config.
Wondering if this could be the problem? However, I have no idea how to see the missing config. Any hint would be appreciated.
Same here, no mails, spent two days searching my error just to realise it seems related to some Sendgrid incompatibility and not a bug of mine. Got the same errors as denisfelst: subscriber is missing a config.
@medusa/medusa: 1.20.2 medusa-plugin-sendgrid: 1.3.12
I'll keep an eye here.
@damienmutt although it might seem obvious, make sure you have redis installed and the connection up and running, as well as its respective lines in medusa.config.js uncommented:
const projectConfig = {
...
redis_url: REDIS_URL
...
}
This was my error. now its picking up all events and i'm able to subscribe to them. FYI my package.json looks like this:
"dependencies": {
"@medusajs/admin": "7.1.11",
"@medusajs/cache-inmemory": "^1.8.9",
"@medusajs/cache-redis": "^1.8.9",
"@medusajs/event-bus-local": "^1.9.8",
"@medusajs/event-bus-redis": "^1.8.11",
"@medusajs/file-local": "^1.0.3",
"@medusajs/medusa": "1.20",
"@tanstack/react-query": "4.22.0",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"dotenv": "16.3.1",
"express": "^4.17.2",
"medusa-fulfillment-manual": "^1.1.39",
"medusa-interfaces": "^1.3.8",
"medusa-payment-manual": "^1.0.24",
"medusa-payment-stripe": "^6.0.7",
"medusa-plugin-mailchimp": "^1.1.50",
"medusa-plugin-sendgrid": "^1.3.12",
"prism-react-renderer": "^2.0.4",
"typeorm": "^0.3.16"
},
Hope that helps. Good luck!
@denisfelst Config correct and Redis running, copied your package but still not working. I'll check .env and Sendgrid again, just let me ask you a question:
Did you still get subscriber is missing a config warning? or is it gone? just to know if I can rely on that.
Thanks!
@damienmutt
Nope, I just checked and don't get it anymore (see screenshot, this is when I complete the order).
Maybe check again your env as you say, renew your sendgrid API key, check the request is being sent (eg. log something on node_modules\@sendgrid\client\src\classes\client.js -> request function see if there's a request error, it might be your API is not working), check if your template options are right, try other ones as well, perhaps other events are triggering, like cancelling an order ... my config is:
const plugins = [
...
{
resolve: `medusa-plugin-sendgrid`,
options: {
api_key: process.env.SENDGRID_API_KEY,
from: "info@silice.glass",
order_placed_template: process.env.SENDGRID_ORDER_PLACED_TEMPLATE_KEY,
order_shipment_created: process.env.SENDGRID_ORDER_SHIPPED_TEMPLATE_KEY,
order_canceled_template: process.env.SENDGRID_ORDER_CANCELED_TEMPLATE_KEY,
}
},
And again, double-check your redis config (port number is ok, try redis-cli ping, etc.). If there's any code you can share, I'd be happy to give it a try. It's quite frustrating, I know.
@damienmutt actually I just checked again. Yes, I do get the same messages.
The subscriber in ...\medusa-plugin-sendgrid\subscribers\order.js is missing a config.
I guess you don't have to rely on that anymore. Sorry for the confusion. Still, I left my previous post just in case it helps you somehow.
@denisfelst @damienmutt This cannot be a configuration issue, as the error is shown when validating the subscriber inside a loader validator.
Subscribers using loaders was introduced in 1.18 (as a breaking change). The root cause of this error is the sendgrid plugin not being migrated to subscribe with a loader.
Hey guys. I have the same issue with the plugin, any news?
Hey guys. I have the same issue with the plugin, any news?
Mine did not work on local but did in prod... weird; I need to test everything again.
Hey guys. I have the same issue with the plugin, any news?
Mine did not work on local but did in prod... weird; I need to test everything again.
Did you mean, that's only in production can I have the test? I don't know, in my case is for a storefront application with real products and cash. If only in production it's possible to test, it means I need to pay one product.
Same here, both in local and prod. In the end I had to create my own endpoints for password reset both for customer and user because the emails were never sent, they are always stuck in the subscribers queue. Later I will have to add also order_placement and similar to temporarly fix this issue.
I guess Sendgrid plugin works, just not the event subscription as the action never gets fired. At the start I though it was a configuration issue with Sendgrid, but if I use the "dynamic usage" explained in the documentation it just works and emails are being sent with no issue.
I have Redis and all enabled, not using the local module. Probably some issue with event subscribers.
I had the same problem, then I noticed that the redis config was commented out, followed this article, and now sendgrid is working perfectly.
FYI, I am still getting
The subscriber in ...\medusa-plugin-sendgrid\subscribers\order.js is missing a config.
ResponseError: Bad Request at node_modules/@sendgrid/client/src/classes/client.js:146:29 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 400, response: { headers: { server: 'nginx', date: 'Mon, 12 Feb 2024 08:48:48 GMT', 'content-type': 'application/json', 'content-length': '851', connection: 'keep-alive', 'access-control-allow-origin': 'https://sendgrid.api-docs.io', 'access-control-allow-methods': 'POST', 'access-control-allow-headers': 'Authorization, Content-Type, On-behalf-of, x-sg-elas-acl', 'access-control-max-age': '600', 'x-no-cors-reason': 'https://sendgrid.com/docs/Classroom/Basics/API/cors.html', 'strict-transport-security': 'max-age=600; includeSubDomains' }, body: { errors: [Array] } } }
medusajs/medusa: 1.20 v medusajs/medusa-cli: 1.3.21 v
facing this error while using the sendGrid to send the order confirmation emails.
Also, pls provide the correct steps, In docs is somewhat, confusing, may be I missed something just to check with. Thanks! FYI: @olivermrbl
Just in case this is still an issue for you, or if anyone else comes up against this.
I received this error when I used the incorrect value for templateID
- i first attempted to use the name of the sendgrid template - you must use the Template ID
Hello guys, I have installed Medusa send grid, having an account in send grid also has Single Sender Verification. I have loaded the plugin in the Medusa config file still I am still struggling to send the mail to reset user password. Please guide for the same.
Its very simple, You just need to create a template and mention that template in the sendgrid config
Best Regards Govind Diwakar Director - Source Good Food Tech Private Limited
On Wed, 27 Mar 2024 at 16:45, AbhinavChavareTechcopain < @.***> wrote:
Hello guys, I have installed Medusa send grid, having an account in send grid also has Single Sender Verification. I have loaded the plugin in the Medusa config file still I am still struggling to send the mail to reset user password. Please guide for the same.
— Reply to this email directly, view it on GitHub https://github.com/medusajs/medusa/issues/5969#issuecomment-2022514122, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXEQJHCNKXIAAULXAOL6ZTDY2KS4NAVCNFSM6AAAAABBE4B5CCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMRSGUYTIMJSGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
--
This message (including any attachments) may contain confidential, proprietary, privileged and/or private information. The information is intended to be for the use of the individual or entity designated above. If you are not the intended recipient of this message, please notify the sender immediately, and delete the message and any attachments. Any disclosure, reproduction, distribution or other use of this message or any attachments by an individual or entity other than the intended recipient is prohibited.
Thanks for the reply, I have made the dynamic template in Sendgrid. How to Integrate SendGrid in Your Open Source Ecommerce_javascript_开源小助理-开源 (csdn.net)https://devpress.csdn.net/opensource/62f4186f7e66823466187ead.html I have referred this article but still not able to receive mail to reset the user password.
Best Regards,
Abhinav Balkrishna Chavare
TechCopain IT Solutions Pvt. Ltd.
I solved this by using npm instead of yarn, and the email notification works perfectly. It seems like the problem is the same as in #5902.
I am not sure if it resolves the errors above but in my case it just was a typo in the medusa-config.js and because it's in the documentation like this i think it is worth sharing.
I followed the Documentation under https://docs.medusajs.com/plugins/notifications/sendgrid#order-shipment-created and put the provided key order_shipped_template
in my medusa-config.js file.
So after trying a lot of different things I started checking the code of src/services/sendgrid.js
(Node Module) i saw that there is a getTemplateId
function which normalizes the Event-Key to (probably) get the Template-Id from the config file later. (Also i could not find any hard coded order_shipped_template
in the code. )
I tried order_shipment_created_template
as key and it suddenly worked.
So i hope this helps others as well :)
@damienmutt actually I just checked again. Yes, I do get the same messages.
The subscriber in ...\medusa-plugin-sendgrid\subscribers\order.js is missing a config.
I guess you don't have to rely on that anymore. Sorry for the confusion. Still, I left my previous post just in case it helps you somehow.
I am getting the same warning. Please help out
I have created dynamic template and added sendgrid key, from email and template id in env and in medusa.config file. Still struggling to send order placed email. I am not knowing that what i am missing more. Can anyone suggest me in this? I did all this in backend code.
@falguni-green-apex, can you share your plugin configuration?
@falguni-green-apex, can you share your plugin configuration?
Here is plugin configuration that i have applied in medusa-config.js file and dynamic template in my sendgrid account.
{
resolve: medusa-plugin-sendgrid
,
options: {
api_key: process.env.SENDGRID_API_KEY,
from: process.env.SENDGRID_FROM,
order_placed_template: process.env.SENDGRID_ORDER_PLACED_TEMPLATE
},
},
Hey, thanks for the report! Since v2 brought a lot of architectural and API changes on the backend, we will be closing this ticket since it no longer applies to our new setup, or the issue has already been fixed. If you are still facing issues with v1, please open a new ticket and we will address it as soon as possible. Thanks! 🙏
@sradevski Sorry, but i don't see how the last message is a valid conclusion to this issue. This was raised for v1, not v2. Using Medusa 1.20.9 and medusa-plugin-sendgrid 1.3.13 the plugin loads but no emails are sent with the everything set up on Sendgrid.
Receiving warning:
warn: The subscriber in E:\proyectos personales\centr0\mercur\marketplace-1.2.x\marketplace\api\node_modules\medusa-plugin-sendgrid\subscribers\order.js is missing a config. warn: The subscriber in E:\proyectos personales\centr0\mercur\marketplace-1.2.x\marketplace\api\node_modules\medusa-plugin-sendgrid\subscribers\restock.js is missing a config. warn: The subscriber in E:\proyectos personales\centr0\mercur\marketplace-1.2.x\marketplace\api\node_modules\medusa-plugin-sendgrid\subscribers\user.js is missing a config
Is there any plan to fix this? It confuses me "or the issue has already been fixed". Where is the fix?
@NicolasGorga if it is still an issue, please submit a reproduction of the issue with some more information based on your debugging. As you can see in the thread, there have been many issues reported and many people resolved the issue on their own, as it was mostly a configuration issue.
We've tested the plugin and it works, so I would suggest you have a look at your configuration first, and ensure everything is set up correctly in sendgrid (domain verification and so on).
@sradevski I had already validated everything was okay with sendgrid, since i was able to send emails, by calling directly sendNotification method of the plugin service class, inside a custom API route. Created new issue with as much detail as possible of the different debugging i did and things i found, hope this gets solved, regardless of V2, since many of us use and will still use V1 for quite some time, thanks!
Bug report
Describe the bug
The Sendgrid plugin is using the deprecated Subscriber method (valid until 1.17).
When using Medusa 1.18, the plugin will not load.
System information
Medusa version (including plugins): 1.18 Node.js version: Database: Operating system: Browser (if relevant):
Additional context
SendGrid plugin subscriber
Also possible root case for #4291