Hi all - hoping for some help debugging graphql-re...
# orm-help
c
Hi all - hoping for some help debugging graphql-request. Apologies if this is the wrong space for that! Here's what I'm trying to do. Environment is Firebase function running on Node 10.
Copy code
const request = require('graphql-request');
const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);

exports.processSignUp = functions.auth.user().onCreate(async (user) => {
  const client = new request.GraphQLClient('GRAPHQL_ENDPOINT_URL', {
    headers: {
      'content-type': 'application/json',
      'x-admin-secret': 'GRAPHQL_ADMIN_SECRET',
    },
  });
  const mutation = `Mutation goes here...`;
  const data = await client.request(mutation, { Variables go here... });
  return data;
});
When I run this, I get the following error:
Copy code
ReferenceError: Headers is not defined
    at resolveHeaders (/workspace/node_modules/graphql-request/dist/index.js:74:32)
    at GraphQLClient.<anonymous> (/workspace/node_modules/graphql-request/dist/index.js:135:35)
    at step (/workspace/node_modules/graphql-request/dist/index.js:44:23)
    at Object.next (/workspace/node_modules/graphql-request/dist/index.js:25:53)
Any help is much appreciated!
Fixed - here's the solution for anyone else: https://github.com/prisma-labs/graphql-request/issues/206
💯 1