Azure/azure-storage-node

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

Closed this issue · 3 comments

DVGY commented

For latest features support, please switch to Azure Storage JavaScript SDK V10.

Which service(blob, file, queue, table) does this issue concern?

{
  "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) here "path": "compressedprojectimages/{filename}"
suppose the file name is test.jpg so the compressedprojectimages container should also store test.jpg.

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

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

Found this error which blob was created in container

Thanks

@DVGY

Thanks for reaching us, as the provided context, this looks like a eventgrid related question, would you create an issue in latest JS repo for eventgrid?

DVGY commented

as the provided context

Yes sure

Closing the issue, as it's not related to storage node.js SDK.