Sendgrid-nodejs: deepmerge needs to be updated to latest version to prevent webpack bug

Created on 28 Feb 2019  路  9Comments  路  Source: sendgrid/sendgrid-nodejs

Issue Summary

The current deepmerge version doesn't work with Webpack:

TypeError: merge is not a function
    at Personalization.deepMergeDynamicTemplateData (/opt/sulvo/cloudflare-app/handlers/.webpack/service/webpack:/node_modules/@sendgrid/helpers/classes/personalization.js:289:1)
...

This is a known issue.

Steps to Reproduce

  1. Setup Webpack
  2. Send a transactional email injecting dynamic template data, e.g:
import sgMail from '@sendgrid/mail'

sgMail.setApiKey(process.env.SENDGRID_API_KEY)

sgMail
  .send({
    to: '[email protected]',
    from: '[email protected]',
    templateId: '...',
    dynamicTemplateData: {
      name: '',
    },
  }).catch(console.error)

Technical details:

  • sendgrid-nodejs version: 6.3.1
  • Node.js version: 10.15.1
easy help wanted help wanted bug up for grabs up-for-grabs

Most helpful comment

If currently you're using Webpack, just add this to your webpack config file (I know this is dirty, but it works!).

  resolve: {
      alias: {
        deepmerge$: 'deepmerge/dist/umd.js',
      }
  }

All 9 comments

Thanks for bringing this to our attention @celicoo! I've added this to the backlog.

@thinkingserious any update on this?

Is this going to be included in a release soon?

Hi, this is blocking sendgrid adoption for us. Any ETA on release?

Blocking adoption for us too, please let us know what the status is. Thanks!

I am getting this issue too :(

If currently you're using Webpack, just add this to your webpack config file (I know this is dirty, but it works!).

  resolve: {
      alias: {
        deepmerge$: 'deepmerge/dist/umd.js',
      }
  }

Note that updating to 6.5.1, which includes #935, didn't work. I had to implement the workaround by @terryds, which worked!

Also ran into this issue... giving @terryds's dirty solution a try... come on sendgrid!

Was this page helpful?
0 / 5 - 0 ratings