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.

[messaging] http module : failed to execute source

See original GitHub issue

[READ] Step 1: Are you in the right place?

  • For issues related to the code in this repository file a Github issue.
  • If the issue pertains to Cloud Firestore, read the instructions in the “Firestore issue” template.
  • For general technical questions, post a question on StackOverflow with the firebase tag.
  • For general Firebase discussion, use the firebase-talk google group.
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Operating System version: MongoDB Atlas Trigger (Realm App)
  • Firebase SDK version: 11.0.1
  • Firebase Product: messaging
  • JS SDK Version: 3.18.0
  • NPM version: I don’t know

[REQUIRED] Step 3: Describe the problem

Executing admin.messaging().sendMulticast(message) returns an error but is actually working :

FunctionError: 'http' module: FunctionError: failed to execute source for 'node_modules/@fastify/busboy/lib/main.js': FunctionError: failed to execute source for 'node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js': FunctionError: failed to execute source for 'node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js': FunctionError: failed to execute source for 'node_modules/@fastify/busboy/lib/utils.js': TypeError: Value is not an object: undefined
    at node_modules/@fastify/busboy/lib/utils.js:23:27(322)

    at require (native)
    at node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js:15:24(29)

    at require (native)
    at node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js:19:28(39)

    at require (native)
    at node_modules/@fastify/busboy/lib/main.js:28:21(44)

    at execute (native)
    at <eval>:16:29(8)
    at K (<eval>:10:6625(35))
    at <eval>:10:4454(115)
    at M (<eval>:10:9199(23))
    at T (<eval>:10:9026(174))
    at <eval>:10:9810(49)
    at onStreamRead (<eval>:10:2062(36))

My Atlas Trigger reports error anyway even if the code is successfully executed.

Here is my StackOverflow bounty on the subject but since no one has an obvious answer i have decided to raise an issue here.

Steps to reproduce:

  1. Create a MongoDB Atlas trigger
  2. Add firebase-admin as external dependency
  3. Add the service-account.json as a value
  4. Run the code with the below code

Relevant Code:

exports = async function() {

  const admin = require("firebase-admin");
  const json_creds = context.values.get("service_account_value_name");
  	  
    const title = "Test";
    const body = "This is a test";
   
    const message= {
      android: {
        notification: {
          title: title,
          sound: "default",
          body: body,
        },
      },
      apns: {
        payload: {
          aps: {
            alert: {
              title: title,
              body: body,
            },
            mutableContent: 1,
            contentAvailable: 1
          }
        },
      },
      tokens: ["device_token_1", "device_token_2"]
    };
    	
    admin.initializeApp({
        credential: admin.credential.cert(JSON.parse(json_creds))
      });
  
    admin.messaging().sendMulticast(message);

    console.log("Messages sent !");
  }
}

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Uzlopakcommented, Nov 21, 2022

@lahirumaramba

If you can provide a PR, I would gladly look in to it.

1reaction
Uzlopakcommented, Sep 24, 2022

I will have a look at it latest on monday.

Read more comments on GitHub >

github_iconTop Results From Across the Web

http module : failed to execute source Node JS Atlas trigger
I have added a dependency to my Atlas trigger ( firebase-admin ). and it was working fine yesterday with the same code as...
Read more >
IIS AspNetCore Module V2: Failed to start application '/LM ...
I have a .NET Core 3.1 Web API project that I am hosting using IIS. Project Details (see target framework):. <Project Sdk="Microsoft.NET.
Read more >
Error Handlers | MuleSoft Documentation
Because the request produces an HTTP:NOT_FOUND error, the Studio console prints an error message indicating that OnErrorContinueHandler is handling the error.
Read more >
HTTP | Node.js v19.3.0 Documentation
If a client connection emits an 'error' event, it will be forwarded here. Listener of this event is responsible for closing/destroying the underlying...
Read more >
Troubleshooting Systems Manager Automation
This topic includes specific tasks to resolve issues based on Automation error messages. Topics. Common Automation errors; Automation execution failed to start ......
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