Shopify / shopify-app-js

MIT License
234 stars 91 forks source link

Enhancement Express middleware default options on processWebhooks #776

Open leonardo-ornelas opened 1 year ago

leonardo-ornelas commented 1 year ago

Overview/summary

ProcessWebhooks method on @shopify/shopify-app-express does not allow users to change the express middleware default options, such as limit parameters. This can be limiting for some use cases Eg. big webhook payload, and I think it would be beneficial to allow users to customize it without to rewrite the whole function.

export function processWebhooks({
  api,
  config,
}: ApiAndConfigParams): ProcessWebhooksMiddleware {
  return function ({webhookHandlers}: ProcessWebhooksMiddlewareParams) {
    mountWebhooks(api, config, webhookHandlers);

    return [
      express.text({type: '*/*'}),
      async (req: Request, res: Response) => {
        await process({
          req,
          res,
          api,
          config,
        });
      },
    ];
  };
}

Eg. i would like to change

 express.text({ type: '*/*', limit: '1MB' }),
github-actions[bot] commented 1 month ago

We're labeling this issue as stale because there hasn't been any activity on it for 60 days. While the issue will stay open and we hope to resolve it, this helps us prioritize community requests.

You can add a comment to remove the label if it's still relevant, and we can re-evaluate it.