Skip to content

Migrate to new sls return syntax#657

Open
briannval wants to merge 11 commits intodevfrom
refactor-callback-pattern
Open

Migrate to new sls return syntax#657
briannval wants to merge 11 commits intodevfrom
refactor-callback-pattern

Conversation

@briannval
Copy link
Contributor

@briannval briannval commented Feb 13, 2026

@briannval briannval changed the base branch from master to dev February 13, 2026 05:19
// HTTP handlers

export const getProjects = async (event) => {
export const getProjects = async (event, ctx, callback) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait i think this is fine, JS params just need to be ordered correctly for how they're called and as long as we have event its fine (since we're not really doing anything with ctx here like ratelimiting or otherwise) but standardization is maybe helpful?

Copy link
Contributor Author

@briannval briannval Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to standardize to avoid any surprises, this is the known syntax across all services, except for btx. Thoughts?

Copy link
Member

@kevinxiao27 kevinxiao27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits
Would just make sure teams API behaviour has not changed (since that .then .catch effects are not translated to a form that has identical behaviour)

key,
publicUrl
});
callback?.(null, res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea this syntax is cursed thank you for removing it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)


// WebSocket connect
export const wsConnect = async (event) => {
export const wsConnect = async (event, ctx, callback) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto earlier comment, we can decide what we want to do about it though

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same reply as above


callback(null, response_fail);
return response_fail;
const res = await teamHelpers.makeTeam(data.team_name, data.eventID, data.year, data.memberIDs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm I'm not sure this is still the same behaviour i'm not sure upon failure the res is null, would probably manually intervene for this edit

Copy link
Contributor Author

@briannval briannval Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a valid point of concern. After looking into it deeper, there is no need to do a check like this, or to have a separate conditional here, since the entire endpoint is wrapped in a try/catch already. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants