question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't take screenshot with emoji on Firebase Cloud Functions

See original GitHub issue

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.12.2
  • Platform / OS version: Firebase
  • URLs (if applicable):
  • Node.js version: 8

What steps will reproduce the problem? ` import * as functions from ‘firebase-functions’; import * as admin from ‘firebase-admin’; admin.initializeApp(); const storage = admin.storage(); const puppeteer = require(‘puppeteer’);

function screenshot() {
    (async () => {
      const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] });
      const page = await browser.newPage();
      await page.goto("https://getemoji.com/"); //go to emoji page
      await page.screenshot({
        path: '/tmp/screenshot.png',
        omitBackground: true,
      })
      .then(() => {
        // upload screenshot to firebase storage
        storage.bucket('bucketName').upload('/tmp/screenshot.png')
        .then(() => {
          console.log("success");
        })
        .catch(error => {
          console.log(error);
        });
      })
      .catch(e => {
        console.log(e);
      });
    })();
}

`

  1. create HTTP Cloud Function
  2. call the screenshot function inside of the HTTP function

What is the expected result? screenshot.png is uploaded to storage, and can see emoji clearly in the image

What happens instead? screenshot.png is uploaded to storage, but can’t see emoji in the image.

here is the result screenshot of “https://getemoji.com/”: screenshot

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
C0retekcommented, Apr 13, 2020

I had the same issue Puppeteer/headless Chrome rendering emojis as □□□□

For those that are looking for a workaround, here is what worked for me, copy the font file in the local fonts folder:

sudo su

#check if font is installed
fc-match "Noto Color Emoji"

#if not installed install with following line
apt-get install fonts-noto-color-emoji -y

#font will be in shared folder but puppeteer looks into local folder so copy the font there

#create folder and copy file
mkdir -p /usr/local/share/fonts
cp /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf /usr/local/share/fonts/
chmod 644 /usr/local/share/fonts/NotoColorEmoji.ttf

#clear font cache
fc-cache -fv

Hope this helps if anybody has the same issue

1reaction
aslushnikovcommented, Mar 1, 2019

@steren surprisingly, I don’t have permissions to create new issue.

But the font identifies itself as “Noto Emoji” for me on Linux. I’d guess installing both https://github.com/googlei18n/noto-emoji and https://github.com/googlei18n/noto-fonts should cover all the needs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Cloud Functions + Puppeteer can't take screenshot ...
I'm trying to take screenshot of a page with emoji by puppeteer on Firebase Cloud Functions, but emoji doesn't show up correctly in...
Read more >
Robo scripts reference guide | Firebase Test Lab - Google
This document provides reference information about Robo scripts including structure, capabilities, usage, recording, and actions. Robo scripts are tests ...
Read more >
3 Firebase services in a simple Android app | by Rahul Pandey
It's fun to see the “story” created by other users in the app and try to interpret what their emoji means. The app...
Read more >
Building a realtime chat application using WebSockets with ...
A step by step guide to building a realtime chat app using WebSockets with Angular and Firebase - plus alternative approaches to consider....
Read more >
Authentication - Expo Documentation
You cannot use the Expo proxy ( useProxy ) because they don't allow @ in their redirect ... For educational purposes only: function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found