Skip to content

Adding the SDK Binding Support for Storage Blob #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
May 19, 2025

Conversation

swapnil-nagar
Copy link
Contributor

@swapnil-nagar swapnil-nagar commented Apr 28, 2025

This pull request introduces support for SDK binding for Azure Storage Blob in the Azure Functions Node.js library. Key changes include adding a new boolean property, deferredBinding, which allows users to enable deferred binding for storage blobs. When deferredBinding is enabled, the StorageBlobClient is returned to the user, which contains both the blobClient and containerClient, providing enhanced functionality for interacting with blob storage.

Example

app.storageBlob("storageBlobTrigger", {
  path: "snippets/{name}",
  connection: "SwapnilUserMiTest",
  deferredBinding: true,
  handler: storageBlobTrigger1,
});
export async function storageBlobTrigger1(
  blobStorageClient: StorageBlobClient,
  context: InvocationContext
): Promise<void> {
  context.log(
    `Storage blob function processed blob "${context.triggerMetadata.name}"`
  );
  try {
    // Download the blob content
    const downloadBlockBlobResponse =
      await blobStorageClient.blobClient.download();

    context.log("Contemt: ", downloadBlockBlobResponse );
  } catch (error) {
    console.error("Error downloading blob content:", error.message);
    throw error;
  }
  context.log("Storage blob trigger function executed successfully!");
}

Definition of StorageBlobClient

{
    /**
     * Blob client to be used by this blob input or output. This is the client that will be used to perform operations on the blob storage.
     */
    blobClient: BlobClient;

    /**
     * Container client to be used by this blob input or output. This is the client that will be used to perform operations on the container storage.
     */
    conatinerClient: ContainerClient;
}

@swapnil-nagar swapnil-nagar marked this pull request as ready for review April 28, 2025 03:41
@swapnil-nagar swapnil-nagar requested a review from a team as a code owner April 28, 2025 03:41
@swapnil-nagar swapnil-nagar enabled auto-merge (squash) May 15, 2025 15:47
@swapnil-nagar swapnil-nagar disabled auto-merge May 15, 2025 22:57
@swapnil-nagar swapnil-nagar enabled auto-merge (squash) May 15, 2025 22:57
@EvanR-Dev EvanR-Dev self-requested a review May 19, 2025 20:09
auto-merge was automatically disabled May 19, 2025 20:11

Pull request was closed

@swapnil-nagar swapnil-nagar reopened this May 19, 2025
@swapnil-nagar swapnil-nagar requested a review from EvanR-Dev May 19, 2025 20:17
@swapnil-nagar swapnil-nagar merged commit 4845f8c into v4.x May 19, 2025
13 checks passed
@swapnil-nagar swapnil-nagar deleted the swapnil/SdkBindingBlob branch May 19, 2025 20:21
swapnil-nagar pushed a commit that referenced this pull request May 22, 2025
swapnil-nagar added a commit that referenced this pull request May 22, 2025
* Revert "Adding the SDK Binding Support for Storage Blob (#341)"

This reverts commit 4845f8c.

* Updating Undici version

* Fix tests

---------

Co-authored-by: Swapnil Nagar <swapnilnagar+microsoft@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants