Skip to content
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

Provide ability to handle output binding failures in JavaScript #1652

Closed
paulbatum opened this issue Jun 30, 2017 · 4 comments
Closed

Provide ability to handle output binding failures in JavaScript #1652

paulbatum opened this issue Jun 30, 2017 · 4 comments
Labels

Comments

@paulbatum
Copy link
Member

If you're writing a function that is using a trigger type that has no built-in retry such as a HTTP or Event Hubs there is no way to handle errors that occur when executing output bindings. This can result in the loss of data. The same is not true in C#, because types such as IAsyncCollector can be used and flushed while in user code e.g.

        public static async Task Run(
            EventData sensorEvent,            
            IAsyncCollector<EventData> outputWeatherData,            
            TraceWriter log)
        {
            var message = new WeatherData
            {
                SensorId = $"Sensor_1",
                Humidity = 12,
                Precipitation = 12,
                Temperature = 80
            };

            try
            {
                await outputWeatherData.AddAsync(new EventData(JsonSerializerHelper.ToByteArray(message)));            
                await outputWeatherData.FlushAsync();
            }
            catch(Exception e)
            {
                // handle error
            }
        }

A good JavaScript experience might look something like this:

module.exports = function (context, myQueueItem) {
    context.log('JavaScript queue trigger function processed work item', myQueueItem);    
    context.done(null, { myOutput: { text: 'hello there, world', noNumber: true }}, function(err) {
        // handle output binding errors
    });
};
@christopheranderson christopheranderson self-assigned this Jul 7, 2017
@christopheranderson christopheranderson added this to the Next milestone Jul 7, 2017
@christopheranderson
Copy link
Contributor

I'll work on a design for this. We should try to get to this in 2.x

@MikeStall
Copy link
Contributor

I think @mathewc 's error filter work would provide a solution for this.

@mathewc
Copy link
Member

mathewc commented Aug 10, 2017

Yes - for Azure/azure-webjobs-sdk#980 we're enabling exception filters that can handle ALL execution errors.

@pragnagopa
Copy link
Member

Closing as the fix for Azure/azure-webjobs-sdk#980 is now available

@pragnagopa pragnagopa removed this from the Backlog milestone Mar 27, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants