chrome-aws-lambda: [BUG] Error: spawn ETXTBSY

hi, I got very strange error, unfortunately I didn’t find anything related to my issue. If possible please have a look at this.

Environment

  • chrome-aws-lambda Version: ^1.20.2,
  • puppeteer / puppeteer-core Version: ^1.20.0
  • OS:
  • Node.js Version: 8 and 10

I tried to run it on different AWS node versions.

Logs: 2019-10-15T21:42:28.073Z 1930cd72-b389-41b5-b5bd-d4534dd0bc25 ERROR Error while generating pdf:Error: spawn ETXTBSY 2019-10-15T21:42:28.076Z 1930cd72-b389-41b5-b5bd-d4534dd0bc25 ERROR Error: params.Body is required at ManagedUpload.validateBody (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:271:13) at ManagedUpload.configure (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:123:10) at new ManagedUpload (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:95:10) at features.constructor.upload (/var/task/node_modules/aws-sdk/lib/services/s3.js:1133:20) at /var/task/services/awsUploader.js:18:8 at new Promise (<anonymous>) at Object.uploadFile (/var/task/services/awsUploader.js:17:10) at module.exports (/var/task/export.js:38:40) 2019-10-15T21:42:28.076Z 1930cd72-b389-41b5-b5bd-d4534dd0bc25 INFO finally: 2019-10-15T21:42:28.094Z 1930cd72-b389-41b5-b5bd-d4534dd0bc25 ERROR Invoke Error { “errorType”: “Error”, “errorMessage”: “params.Body is required”, “stack”: [ “Error: params.Body is required”, " at ManagedUpload.validateBody (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:271:13)“, " at ManagedUpload.configure (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:123:10)”, " at new ManagedUpload (/var/task/node_modules/aws-sdk/lib/s3/managed_upload.js:95:10)“, " at features.constructor.upload (/var/task/node_modules/aws-sdk/lib/services/s3.js:1133:20)”, " at /var/task/services/awsUploader.js:18:8", " at new Promise (<anonymous>)“, " at Object.uploadFile (/var/task/services/awsUploader.js:17:10)”, " at module.exports (/var/task/export.js:38:40)" ] }

my code:

 const generatePDF = async data => {
   try {
     const browser = await chromium.puppeteer.launch({ 
      args: chromium.args,
      defaultViewport: chromium.defaultViewport,
       executablePath: await chromium.executablePath,
      headless: chromium.headless
     });
     const page = await browser.newPage();
 
     await page.goto(`file://${BASE_FILE}`, {
       waitUntil: 'networkidle0'
     });
 
     console.log(data);
 
     page.on('console', msg => console.log('PAGE LOG:', msg.text()));
 
     await page.evaluate(async params => await startVue(params), data);
 
     const pdf = await page.pdf({ format: 'A4' });
 
     browser.close();
     return pdf;
   } catch (error) {
     console.error(`Error while generating pdf:${error}`);
     throw error;
   }
 };

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I am having the same issue

@gventuri it could happen when you launch more than 1 puppeteer instance synchronously in your code.

is it your case?

@alixaxel can you reopen the issue ?

@karimc1 It’s really hard to help without a complete repro. My guess is that you’re calling convertToPdf multiple times from the same Lambda instance? Also, you only have a single chrome-aws-lambda layer attached right?

The ETXTBSY error code is thrown when puppeteer is trying to start the Chromium binary but the binary file is under a exclusive lock - that can happen if you don’t wait for executablePath to resolve, or, if you call executablePath multiple times.

I’d be happy to help you further if you need, just open a new issue and share a full repro.

Sam issue happening to me, everything on the latest versions