-
Notifications
You must be signed in to change notification settings - Fork 42
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
Response headers doesn't work #407
Comments
Please provide a minimum reproduction repository. |
Repository: https://github.com/joain946/nestjs-azure |
Any update on this @kamilmysliwiec? Do you need any additional input from me? |
I am having the exact same issue, none of the nestjs headers are being sent to the azure function only stock azure response headers. Ran the code from git and npm and having same issue. Seems like the writeHead bound function is never getting called, breakpoint not getting hit in bound function. Info: azure functions v3 |
Interesting Note When using AzureHttpRouter The some headers seem to be sent , most notably 'content-type' |
Ive just hit this exact same issue. Has there been any movement on this.? Only way i can currently work arouns it is remove my app.enableCors() ( as this conflicts with the adapter ) and override the HttpAdapters context |
Hello everyone @nlaurie @gristoi Did you find a workaround ? We are stuck with the exact same issue. Thank you Felix |
Hello everyone, I've found a simple workaround. Thank you. import { Context, HttpRequest } from '@azure/functions';
import { AzureHttpAdapter } from '@nestjs/azure-func-http';
import { createApp } from '../src/main.azure';
function createPsuedoApp(createApp: () => Promise<any>): () => Promise<any> {
return async (): Promise<any> => {
const app = await createApp();
const psuedoApp = {
getHttpAdapter: () => {
return {
getInstance: () => {
return (req: any, res: any) => {
const done = req.context.done;
req.context.done = (err?: string | Error, result?: any) => {
res.writeHead();
done(err, result);
};
app.getHttpAdapter().getInstance()(req, res);
};
},
};
},
};
return psuedoApp;
};
}
export default function(context: Context, req: HttpRequest): void {
AzureHttpAdapter.handle(createPsuedoApp(createApp), context, req);
} |
Would be nice to have a pull request to fix it within azure-func-http. |
We solved thia on host.json file..
All we needed is json response header.. We are using microsoft docker's img to emulate in local environment. |
Only quoting to appoint the file where you need to edit. Add this script on |
Hello everyone, I have the same problem, will it be resolved? |
Somehow this script solves the header problem, but misses the 302 status, making it 200. |
I'm submitting a...
Current behavior
Response headers are not sent back to the client.
The example below returns this response:
Expected behavior
All response headers should be returned to the client.
From the example below the "Content-Type" and "MyHeader" header should have been returned from the REST api.
Minimal reproduction of the problem with instructions
Using this instruction:
https://trilon.io/blog/deploy-nestjs-azure-functions
Then adding two @Header() decorators to the api:
Environment
Workaround
It seems like the writeHead(...) method is never called.
Triggering this method from IDE or through code (in an interceptor) solves the issue.
The text was updated successfully, but these errors were encountered: