Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storycap fails if there is an <iframe> element #563

Open
yamanoku opened this issue Mar 11, 2022 · 2 comments
Open

storycap fails if there is an <iframe> element #563

yamanoku opened this issue Mar 11, 2022 · 2 comments

Comments

@yamanoku
Copy link

yamanoku commented Mar 11, 2022

I created a Vue.js file that loads in an <iframe> by passing YouTube video IDs in props, and ran storycap.
However, when I executed it, I got an error Error: Execution context is not available in detached frame.

Error: Execution context is not available in detached frame "https://www.youtube.com/embed/EngW7tLk6R8?enablejsapi=1&loop=0&playlist=EngW7tLk6R8&rel=0&modestbranding=1" (are you trying to evaluate?)
    at DOMWorld.executionContext (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:82:19)
    at DOMWorld._onBindingCalled (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:364:36)
    at /home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js:52:74
    at /home/runner/src/app/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js:51:43)
    at CDPSession.emit (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:72:22)
    at CDPSession._onMessage (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:225:18)
    at Connection._onMessage (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:101:25)
    at WebSocket.<anonymous> (/home/runner/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js:13:32)
error Command failed with exit code 1.
info Visit yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.
Resource Details

Resource

  • Node.js: 16.14.0
  • storycap: ^3.1.0
  • storybook
    • @storybook/vue3: ~6.3.13
    • vue: ^3.2.29

Vue.js file

<template>
  <iframe id="youtube_player" :src="videoSource" title="YouTube video player" frameborder="0" allowfullscreen="1">
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'YoutubeEmbeddedPlayer',
  props: {
    containerClass: {
      type: String,
      required: false,
      default: null,
    },
    videoId: {
      type: String,
      required: true,
    },
  },
  computed: {
    videoSource: function () {
      return `https://www.youtube.com/embed/${this.videoId}?enablejsapi=1&loop=0&playlist=${this.videoId}&rel=0&modestbranding=1`;
    },
  },  
});
</script>

Storybook

import YoutubeEmbeddedPlayer from './YoutubeEmbeddedPlayer.vue';

export default {
  title: 'pages/root_pages/YoutubeEmbeddedPlayer',
  component: YoutubeEmbeddedPlayer,
};

const Template = (args) => ({
  components: { YoutubeEmbeddedPlayer },
  setup: () => ({ args }),
  template: `<div><YoutubeEmbeddedPlayer v-bind=args /></div>`,
});

export const VideoIdExists = Template.bind({});

VideoIdExists.args = {
  videoId: 'EngW7tLk6R8',
};
@yamanoku
Copy link
Author

There was an issue related to this error that had to do with puppeteer.
puppeteer/puppeteer#7814

It has since been addressed and seems to have been improved in version 13.4.0.
puppeteer/puppeteer#8024
https://github.com/puppeteer/puppeteer/releases/tag/v13.4.0

@sashless
Copy link

sashless commented May 3, 2022

I could fix this locally by using resolutions field to bump internal deps as it is pinned to ^9.0.0 currently

resolutions: {
        "puppeteer-core": "^13.5.2",
},
dependencies: {
        "puppeteer": "^13.5.2",
        "puppeteer-core": "^13.5.2",
}

EDIT:

Looks like i am facing now this one #545

Sometimes it works, sometimes it hangs.

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

Successfully merging a pull request may close this issue.

2 participants