formbricks icon indicating copy to clipboard operation
formbricks copied to clipboard

[BUG][đŸ•šī¸] Dynamic Link Preview broken incl. shortened links

Open jobenjada opened this issue 2 years ago â€ĸ 11 comments

Issue Summary

This issue has two elements:

  1. The Dynamic Link Preview does not work anymore:

// solved

  1. The Link Preview does not (and maybe never did) work for Shortened URLs.

In Formbricks, you can shorten URLs via the top right menu:

Screenshot 2023-12-21 at 14 43 34

The shortened links do not have a preview:

image

Please fix it :)

Steps to Reproduce

  1. Create a link survey
  2. Share URL in any service which creates link previews
  3. Shorten URL and try again

Expected behavior

Same dynamic link preview for both

Other information

No response

Screenshots

No response

Environment

  • [ ] Formbricks Cloud (app.formbricks.com)
  • [ ] Self-hosted Formbricks

Desktop (please complete the following information)

- OS:
- Node:
- npm:

jobenjada avatar Dec 21 '23 20:12 jobenjada

i would like to give it a try :smiley: !

adityadeshlahre avatar Dec 22 '23 20:12 adityadeshlahre

Sure, go for it @adityadeshlahre 😊🚀

Dhruwang avatar Dec 24 '23 14:12 Dhruwang

Seems like

1 Dynamic Link Preview works fine previewWorking

2 Shortened URLs Link Previews are dead previewDead

on the way to fix :smiley:

adityadeshlahre avatar Dec 29 '23 17:12 adityadeshlahre

@adityadeshlahre any updates? :)

jobenjada avatar Jan 04 '24 21:01 jobenjada

Hey @jobenjada @Dhruwang really sorry for late replay i am still trying to fix the bug !

I got to know which component is responsable for image generation [file] but stuck on how the file is getting called at time of publishing New Survey

For now preview image generation is only happening for main /s/[surveyId] link only and not for the short URL /[shortUrlId] link. [maybe be VERCEL og-image-generation doesn't work for shortURL because lack of Metadata/Props](might am wrong here)

on shorting [main URL] from different URL shorting service its PREVIEW-IMAGE working fine.

need more lights on the bug !

adityadeshlahre avatar Jan 07 '24 21:01 adityadeshlahre

hmm @mattinannt maybe you have an idea?

// can confirm the normal preview generation works :)

image

jobenjada avatar Jan 15 '24 16:01 jobenjada

@adityadeshlahre Yes, this is the right endpoint for generating the image :-) The image from the og endpoint is used in the generateMetadata function of the /s/[surveyId] page: https://github.com/formbricks/formbricks/blob/be4534da2d8d7bd197a40a87fc9d32ed2bf06fac/apps/web/app/s/%5BsurveyId%5D/page.tsx#L63

So one thing you could try is to also add a generateMetadata function to apps/web/app/[shortUrlId]/page.tsx.

But this may lead to duplicated code and issues since we also need to query all the data in the shortUrl redirect. There might be a better option where we can reference the content of the redirected page in the meta data so we tell the preview loaders where to look for the meta data. See this stackOverflow thread for an example: https://stackoverflow.com/questions/54160345/how-to-make-open-graph-links-work-with-301-redirects

mattinannt avatar Jan 16 '24 09:01 mattinannt

@adityadeshlahre will you pick this up again? :)

jobenjada avatar Feb 11 '24 15:02 jobenjada

Hey @jobenjada sorry for not responding for way long !

would like get this issue unassigned for now .

I think i will take back seat and learn from the changes if anyone contributes on this issue :slightly_smiling_face:

Thank You

adityadeshlahre avatar Feb 11 '24 16:02 adityadeshlahre

@adityadeshlahre No worries, thanks for trying to solve it 😊đŸ’Ē

mattinannt avatar Feb 12 '24 07:02 mattinannt

/assign

KapadiaNaitik avatar Mar 01 '24 22:03 KapadiaNaitik