CodeGenieApp / CodeGenieApp/serverless-express

Issue with json being returned as application/octet-stream

Open
#435 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

I have a pretty standard implementation using the following:

```typescript
import serverlessExpress from '@vendia/serverless-express';
import { app } from '../app/app';

export const handler = serverlessExpress({ app });
```

and an endpoint that responds the following:

```typescript
healthCheck(request: Request, response: Response): Response {
const apiResponse = new ApiResponse({});

return response.json(apiResponse);
}

// apiResponse -> {"data":{},"code":200,"message":"Success"}
```

It's running over an AWS ALB, but the content-type being returned (wrongly) is application/octet-stream.

Is there any configuration to avoid this issue?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the TypeScript serverless-express handler behind an AWS Application Load Balancer and inspect the response headers for the health-check endpoint. The issue is done when the JSON response is returned with an application/json content type rather than application/octet-stream.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, express, node.js, typescript
Domain
api, backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.