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.

How to access the blob name in function.json output bindings path key of a particular blob which triggered event grid

See original GitHub issue

I was referred to this repo by a official member.

{
  "bindings": [
    {
      "type": "eventGridTrigger",
      "name": "eventGridEvent",
      "direction": "in"
    },
    {
      "name": "inputBlob",
      "type": "blob",
      "path": "{data.url}",
      "connection": "projectimagestore_STORAGE",
      "direction": "in",
      "datatype": "binary"
    },
    {
      "name": "outputBlob",
      "direction": "out",
      "type": "blob",
      "path": "compressedprojectimages/{filename}",
      "connection": "projectimagestore_STORAGE"
   ]
}

I want to access the current filename (blob name on which function is being processed) on key “path”: “container/{filename}” suppose the file name is test.jpg so the container container should also store test.jpg.

Note: I have two different container. I am getting input from one container and want to store the processed blob with same filename in another container.

As of now if I try to run function it gives an error like no value for filename

I don’t know what to put in path.

How my function looks like

const fetch = require("node-fetch");
module.exports = async function (context, eventGridEvent, inputBlob) {
    try{
    context.log(typeof eventGridEvent);
    context.log(eventGridEvent);
    context.log(context);
    context.log(typeof inputBlob);
    context.log({inputBlob})

   // context.bindings.outputBlob = inputBlob

    }
};

azure func v2 core tools

node v 12 LTS

Using Blob storage

Found this error which blob was created in container

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ramya-rao-acommented, Dec 29, 2020

Hey @DVGY

Thanks for the clarification and your patience

This repository is for the JavaScript libraries for different Azure services. Your question is more on the side of working with bindings in Azure functions. Based on this pointer for reporting issues, it looks like the right place for you to log this issue would be https://github.com/Azure/azure-webjobs-sdk-script

I was referred to this repo by a official member.

Can you share who referred this repo to you? We would like to make sure we clarify the purpose of this repo to them as well.

Q1. What really happens when we write path:{data.url}? How data.url is made available inside “name”: “inputBlob”, “type”: “blob”, “path”: “{data.url}”, Does it do a search for data.url key inside bindingsData or bindings value present inside Invocation Context. ?

According to JSON payloads and binding expressions, since the event data payload is a JSON object, you are able to refer to anything inside it in the bindings

Unfortunately, the event data payload only has the blob url and not the blob name, otherwise you could have used it. The folks at https://github.com/Azure/azure-webjobs-sdk-script should be able to help you better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Blob storage trigger for Azure Functions | Microsoft Learn
Learn how to run an Azure Function as Azure Blob storage data changes. ... to work with Event Grid triggers and bindings in...
Read more >
Python Azure function triggered by Blob storage printing file ...
I'm triggering an Azure function with a blob trigger event. A container sample-workitems has a file base.csv and receives a new file new.csv....
Read more >
How to Create and Deploy a Simple Blob Trigger In Azure ...
Blob triggers are a very powerful tool in Azure for triggering Azure Functions from events in Azure Storage. In this video, we're going...
Read more >
Chapter 4. Getting Started with Microsoft Azure Functions
We call various functions in response to different events and return a result. ... An Azure Blob Storage trigger to process storage blobs...
Read more >
AZ-204 exam questions for FREE | Azure Developing solutions
The application is used to work with blobs in an Azure storage account. ... You have to define the correct bindings in the...
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