Skip to content
This repository has been archived by the owner on Jan 13, 2021. It is now read-only.

Vapid server crashes when using "unfurl" #134

Open
lsanwick opened this issue Apr 11, 2019 · 3 comments
Open

Vapid server crashes when using "unfurl" #134

lsanwick opened this issue Apr 11, 2019 · 3 comments
Labels

Comments

@lsanwick
Copy link

Describe the bug
Tried to add a new YouTube video link using the unfurl=true option, and the server crashes as soon as I try to load the page rendering that link.

    <div class="container">
      {{video type=link unfurl=true label="Tour Video"}}
    </div>

Server Error:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:406:19)
    at clearBuffer (_stream_writable.js:540:7)
    at onwrite (_stream_writable.js:465:7)
    at Gunzip.afterTransform (_stream_transform.js:94:3)
    at Zlib.processCallback (zlib.js:619:8)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:425:12)
    at onwrite (_stream_writable.js:456:5)
    at doWrite (_stream_writable.js:406:11)
    at clearBuffer (_stream_writable.js:540:7)
    [... lines matching original stack trace ...]
    at Zlib.processCallback (zlib.js:619:8)

To Reproduce
Steps to reproduce the behavior:

  1. Add a link like {{mylink type=link unfurl=true}} to your template
  2. Go to the dashboard, set the link to https://www.youtube.com/watch?v=dQw4w9WgXcQ
  3. Hit the "View" button to go back to the homepage
  4. See error above in Terminal

Expected behavior
A YouTube embedded video should appear.

Your Environment
Include relevant details, so others can replicate the issue.

  • OS: Mac OS X 10.14.3
  • Browser: Chrome
  • Node Version: v10.14.1
  • Vapid Version: v0.7.7
@srobbin
Copy link
Contributor

srobbin commented Apr 17, 2019

@lsanwick Strange. I'm running a fairly similar setup, but can't seem to replicate it:

  • OS: Mac OS X 10.13.6
  • Browser: Chrome
  • Node Version: v10.14.1
  • Vapid Version: v0.8.1

I don't think it should matter, but can you try updating to Vapid v0.8.1?

@srobbin srobbin added the bug label Apr 17, 2019
@spsaucier-bakkt
Copy link

spsaucier-bakkt commented Mar 25, 2020

Upgrading to latest (0.9.5) didn't fix the issue for me.

@spsaucier-bakkt
Copy link

I'm getting around it for now by pasting an embed code into a type=text field and then using this to unescape it:

<script>
  function htmlDecode(input){
    var e = document.createElement('textarea');
    e.innerHTML = input;
    // handle case of empty input
    return e.childNodes.length === 0 ? "" : e.childNodes[0].nodeValue;
  }
  var videos = document.querySelectorAll('.responsive-video');
  videos.forEach(v => {
    v.innerHTML = htmlDecode(v.innerHTML);
  });
</script>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants