Skip to content

Commit 6ca15ec

Browse files
authored
Return JSON body from syncIdentity Post (#634)
Looks like: 1. API returns 201 with content application/json, but doesn't return any content 2. lambda.ts injects a space because streaming responses require a body to be present 3. When the website syncs the users identity, it ends up trying to parse a space and returns Syntax Error: Unexpected end of JSON input 4. Next checkout attempt works because sync succeeded server-side So: - Give it something to parse Tested locally by running website against change deployed to core.aws.qa.acmuiuc.org. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * The sync identity endpoint now returns a JSON body { "success": true } with HTTP 201 Created on success (previously returned an empty body). <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 45cf2c2 commit 6ca15ec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "infra-core",
3-
"version": "4.8.4",
3+
"version": "4.8.5",
44
"private": true,
55
"type": "module",
66
"workspaces": [

src/api/routes/syncIdentity.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ const syncIdentityPlugin: FastifyPluginAsync = async (fastify, _options) => {
7878
description: "The user has been synced.",
7979
content: {
8080
"application/json": {
81-
schema: z.undefined(),
81+
schema: z.object({
82+
success: z.literal(true),
83+
}),
8284
},
8385
},
8486
},
@@ -135,7 +137,7 @@ const syncIdentityPlugin: FastifyPluginAsync = async (fastify, _options) => {
135137
userPrincipalName: `${netId}@acm.illinois.edu`,
136138
});
137139
}
138-
return reply.status(201).send();
140+
return reply.status(201).send({ success: true });
139141
},
140142
);
141143
fastify.withTypeProvider<FastifyZodOpenApiTypeProvider>().get(

0 commit comments

Comments
 (0)