aws-samples / aws-marketplace-serverless-saas-integration

Example of serverless integration for SaaS products listed on the AWS Marketplace.
MIT No Attribution
131 stars 76 forks source link

Lambda@Edge function returns 502 error #64

Open MartinEmrich opened 1 year ago

MartinEmrich commented 1 year ago

Describe the bug Upon filling the sample app form and submitting it, I get a generic cloudfront 502 error page.

Please see also: https://github.com/aws-ia/cloudformation-aws-marketplace-saas/issues/54

To Reproduce Steps to reproduce the behavior:

  1. Install the sample app as described
  2. try to buy the marketplace product

Expected behavior The provided sample app should complete the way it should....

Apparently, the form sends the data as multipart/form-data, but the Lambda@edge function expects application/x-www-form-urlencoded.

MartinEmrich commented 1 year ago

I might have found the cause:

If the client uses one of the most popular content blockers (Adblock whatever, uBlock Origin, etc.) sourcing https://easylist.to/ ff., there ist a rule ||cloudfront.net/script.js therein, Which blocks the sample javascript.

If the javascript cannot be loaded, indeed the above behaviour happens.

After renaming the script.js to marketplace-script.js and modifying index.html accordingly, the error message no longer appears.

Yet then I only get this message in the browser console (which I would never see as a normal non-developer):

"\"Success! Registration completed. You have purchased an enterprise product that requires some additional setup. A representative from our team will be contacting you within two business days with your account credentials. Please contact Support through our website if you have any questions.\""

the page itself looks like nothing happened... Update: The page also displays a notification, which was just hidden due to the small viewport, more an UX issue...