Skip to content

Not able to access response object from context in apollo-server-fastify #3156

@techyrajeev

Description

@techyrajeev

Previously I was using apollo-server-express and I wanted to migrate to fastify so I change it to apollo-server-fastify. But it started giving lots of issues.

One of such issue is - Not able to access res object from context function.
Below code was working perfectly but res object itself was not available with apollo-server-fastify

context: async ({ req, res, connection }) => {
// res <--------- undefined
    if (connection) {
      return {
        models,
      }
    }
    if (req) {
      const me = await getMe(req, res)
      return {
        models,
        me,
        secret: process.env.SECRET,
      }
    }
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions