npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

insomnia-plugin-brokeredmessage

v1.0.2

Published

Re-formats json body message as a BrokeredMessage in order to trigger Azure non-HTTP Functions

Downloads

1,023

Readme

insomnia-plugin-brokeredMessage

Insomnia plugin to re-format json body message as a BrokeredMessage in order to trigger Azure non-HTTP Functions

Issue this solves

Suppose you have an Azure Function that is triggered from an Azure Service Bus (queue or topic subscription). You want to test this (locally) and call the running Azure Function from Insomnia as it is described in the MS docs here.

The http post will call the local Azure Function, and you'll receive a 202 Accepted response. But in the function console, there's an error:

initial-post-success

Console Output from Function

Unable to convert trigger to BrokeredMessage

[2021-07-01T17:53:41.362Z] Executed 'Functions.myHandler' (Failed, Id=xxx, Duration=133ms)
[2021-07-01T17:53:41.363Z] System.Private.CoreLib: Exception while executing function: Functions.myTopicHandler. Microsoft.Azure.WebJobs.Host: Exception binding parameter option binding parameter 'eventMsg'. Microsoft.Azure.WebJobs.ServiceBus: Unable to convert trigger to BrokeredMessage.

The function never hits a breakpoint when trying to debug - the post (our pseudo trigger) is never processed or accepted by the function.

What to do

The fix is to wrap the ServiceBus message payload as an {input: <message>} object. Within the Azure function code, the FunctionInvocation class is just a simple class with one attribute named Input.

Our effect is to call the function like this:

curl --request POST \
  --url http://localhost:7071/admin/functions/myHandler \
  --header 'Content-Type: application/json' \
  --data '{"input": "{\"eventType\":1,\"statusType\":2,"id\":177638636663,"name\":\"container-ue-1\"}"}'

However - having to serialize & wrap you message object every time needs a helper of some sort. Insomia's plugins to the rescue!

Once this plugin is installed, simply set a header Brokered-Message = true on any requests to be re-formatted.

header-example

Install Plugin

Plugins can be added from the Plugins tab within the application preferences dialog. They can also be downloaded and installed directly from npm, or directly from Insomina Plugin Hub.

To install it go to Application > Preferences > Plugins, type the package name "insomnia-plugin-brokeredmessage" and hit Install Plugin. That's it!

Once installed, simply set the header Brokered-Message = true on any JSON message requests to be re-formatted.

If you found this helpful...

Ref's

Insomnia Plugins
Manually Run non-http functions
Functions Code