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

UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of null #3

Open
talentlessguy opened this issue Aug 4, 2019 · 2 comments

Comments

@talentlessguy
Copy link

When I try to transform the following tags:

<meta property="og:title" content="V!RTL" />
<meta property="og:image" content="assets/logo.svg" />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="v1rtl.site" />

I get this error:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of null
    at getMetaTag (/home/v1rtl/Desktop/Coding/v1rtl.site/node_modules/parcel-plugin-ogimage/index.js:11:25)
    at Bundler.<anonymous> (/home/v1rtl/Desktop/Coding/v1rtl.site/node_modules/parcel-plugin-ogimage/index.js:35:20)
    at Bundler.emit (events.js:203:13)
    at Bundler.bundle (/home/v1rtl/Desktop/Coding/v1rtl.site/node_modules/parcel-bundler/src/Bundler.js:361:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
(node:15421) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15421) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Assets content:

➜ tree assets -L 1
assets
├── animation
├── art_bg.webp
├── background.webp
├── blog.webp
├── desktop.webp
├── icons
├── logo.svg
├── marker.webp
├── robots.webp
└── web_bg.webp
@lukechilds
Copy link
Owner

Thanks for submitting an issue.

From the readme:

This plugin uses the value of the og:url meta tag to convert og:image to an absolute URL.

You don't have an og:url meta tag so the plugin is throwing an error.

It would help if we checked for the tags and threw a more useful error explaining the issue. PR welcome.

@talentlessguy
Copy link
Author

Thank you for explaining the issue, yes, I'll make a PR for more friendly message

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