Skip to content
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

Set cookies in lambda resolver #492

Open
2 tasks
Punith13 opened this issue Mar 10, 2022 · 1 comment
Open
2 tasks

Set cookies in lambda resolver #492

Punith13 opened this issue Mar 10, 2022 · 1 comment
Labels
feature-request New feature or request GraphQL

Comments

@Punith13
Copy link

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

GraphQL API

Is this related to another service?

Lambda

Describe the feature you'd like to request

I want to be able to set cookies in my lambda resolver. This would help me store secure, HTTP-only cookies.

Describe the solution you'd like

I want to set cookies in the lambda function like
`
exports.handler = async (event, context, callback) => {

const response = {
headers : {
"Set-Cookie" : [example-cookie=value]
}
}
callback(null, response)

and the set cookie must be available as the response header of the Graphql HTTP call from the client.

Describe alternatives you've considered

Tried to set the cookie client-side, but it is an insecure solution.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@Punith13 Punith13 added the feature-request New feature or request label Mar 10, 2022
@yanlin96
Copy link

yanlin96 commented May 5, 2022

Hi got a similar issue,

Here is my testing experience.

I set up a nginx server locally with the same domain as AppSync endpoint like ".amazonaws.com" to host a front end react app locally. I am using the "$util.http.addResponseHeader("Set-cookie", xxxx-yyyy)" in the VTL resolver, however, I CANNOT see it in the response header while call the api, therefore, not cookie stored in the browser.

@stocaaro stocaaro transferred this issue from aws-amplify/amplify-js Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request GraphQL
Projects
None yet
Development

No branches or pull requests

3 participants