GoogleCloudPlatform / functions-framework-nodejs

FaaS (Function as a service) framework for writing portable Node.js functions
Apache License 2.0
1.29k stars 158 forks source link

Error response headers should not include `etag` #516

Closed garethgeorge closed 10 months ago

garethgeorge commented 1 year ago

The functions framework contract indicates that the etag header should be omitted to prevent bad caching behavior, but the Node.js functions framework sets this header on error statuses.

Tested using curl in its verbose mode, the headers on the response are:

HTTP/2 500
content-type: text/plain; charset=utf-8
etag: W/"15-/6VXivhc2MKdLfIkLcUE47K6aH0"
x-cloud-trace-context: 148795d8e0aec48978d05ed0dab4dae4;o=1
date: Wed, 08 Feb 2023 23:43:55 GMT
server: Google Frontend
content-length: 21

Internal Server Error%

Interestingly, setting etag is already disabled https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/master/src/server.ts#L102 but it seems express is attaching an etag anyway.