Code Monkey home page Code Monkey logo

azure-functions-language-worker-protobuf's Issues

Remove hard copy of google/protobuf/duration.proto

We currently have a hard copied version of the official protobuf duration.proto file so that we can reference it in our custom FunctionRpc.proto file. This causes errors with the java language worker, as it tries to compile duration.proto, which is already defined.

This file was included because it is necessary for compilation in the nodejs and python language workers. However, this shouldn't be necessary. For the python and nodejs, we should see if the language-specific libraries we are using for compilation have updated ways of handling this dependency.

Non-string header values on http response throws error

From @ahmelsayed on April 30, 2018 21:7

From @graham-sportsmgmt on February 17, 2018 3:49

[email protected]
JavaScript HttpTrigger
Local function emulator on Windows 10 x64

I am trying to set a response header in order to flag the length of the result set to our front end code.

This method throws an error:

context.res = {
  "headers" : { "length": response.length },
  "body": response
};

invocationResponse.outputData.data.http.headers: string{k:string} expected

This method doesn't throw an error, but adds no header to the response:

context.res.setHeader('length', response.length);

Copied from original issue: Azure/azure-functions-core-tools#386

Copied from original issue: Azure/azure-functions-host#2768

Git "refusing to merge" updates from consuming repo

There's a bug with git where merge subtree causes a fatal: refusing to merge unrelated histories error.

Change update instruction (2.) to be:
git merge -s subtree proto-file/dev --squash --allow-unrelated-histories

with backup command: git merge -X subtree=<path in language worker repo> --squash proto-file/<version branch> --allow-unrelated-histories

Bindings in protobuf definition

Right now, when receiving an invocation request, you need to check the binding type and construct the typed binding yourself...

(See here and here)

The point of having a protobuf definition should include having the typed bindings.

[FeatureRequest] Add RPC command to send output bindings in advance of InvocationResponse

Issue

If a worker function wants to, say, write to a table output binding, and there is a problem with that binding, there is no way to inform the worker function that the table binding is incorrect during execution so that it can take appropriate action, therefore CreateIfNotExists and other patterns are not possible without leveraging direct SDKs, which kind of defeats the point of using outputbinding in the first place.

Recommended Resolution

Allow workers to submit Output Bindings ahead of final InvocationResponse, and the host can return an immediate result to the worker so that the worker can inform the function if required so it can take appropriate action if there is a problem.

This would be an RPC function definition like SubmitOutputBinding or something.

References

Azure/azure-functions-powershell-worker#284

V3 breaking change: Remove managed_dependency_enabled property from FunctionLoadRequest

We are creating a new message for the Host to tell the worker to Initialize the function app.
For now, it will include two properties: function app root, and managed dependency enable option.

As a result, we will no longer need the managed_dependency_enabled property in FunctionLoadRequest--we need to remove this property once all workers start using this new message.

Add "cookies" property to HttpRpc

We need to allow users to set multiple cookies on the HttpResponse, since we can't fold multiple cookie values into one header and the HttpRequest object does not support duplicated headers.

When you add multiple Set-Cookie headers to the response, actually they are combined and only one header is sent with comma-separated cookies. According to RFC2109 it is a valid syntax. But it is not according to RFC6265, which deprecates RFC2109

Proposal:

// Http cookie type. Note that only name and value are used for Http requests
message RpcHttpCookie {
    // Enum that lets servers require that a cookie shouoldn't be sent with cross-site requests
    enum SameSite {
        Undefined = 0;
        Strict = 1;
        Lax = 2;
    }
    
    // Cookie name
    name: string,
    
    // Cookie value
    value: string,

    // Specifies allowed hosts to receive the cookie
    domain: NullableString,

    // Specifies URL path that must exist in the requested URL
    path: NullableString,

    // Sets the cookie to expire at a specific date instead of when the client closes
    expires: NullableString // becomes Nullable<DateTimeOffset> in C#, maybe use google.protobuf.Timestamp?

    // Sets the cookie to only be sent with an encrypted request
    secure: bool, 

    // Sets the cookie to be inaccessible to JavaScript's Document.cookie API
    http_only: bool,

    // Can restrict the cookie to not be sent with cross-site requests
    same_site: SameSite,

    // Sets the cookie to expire after a specific length of time instead of when the client closes
    max_age: NullableString // becomes Nullable<TimeSpan> in C#, maybe use google.protobuf.Duration?
}

Document versioning

git fetch proto-file refs/tags/v1.1.0-protofile

git merge -X subtree=src/WebJobs.Script.Grpc/azure-functions-language-worker-protobuf --squash v1.1.0-protofile --allow-unrelated-histories

Null values for "map" type causes Buffer overrun on some languages

Causes buffer overrun, first reported here: Azure/azure-functions-nodejs-worker#142

The root cause of this issue is that we use a "map" in our protobuf file.

From the protocol buffers docs:

If you provide a key but no value for a map field, the behavior when the field is serialized is language-dependent. In C++, Java, and Python the default value for the type is serialized, while in other languages nothing is serialized.

In combination with protobuf.js, this results in generated code that overflows.

                    case 15:
                        reader.skip().pos++;
                        if (message.query === $util.emptyObject)
                            message.query = {};
                        key = reader.string();
                        reader.pos++;
                        message.query[key] = reader.string();
                        break;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.