Skip to content

Unable to set @graphql-hive/client token in firebase function #4172

@kdawgwilk

Description

@kdawgwilk

For context firebase functions require you to load secrets at runtime but the functions themselves get built so the code is partially executed. So when trying to build this firebase functions project:

const hiveToken = defineSecret('HIVE_TOKEN');

const graphqlRequestHandler = createYoga({
  schema,
  graphqlEndpoint: '*',
  plugins: [useYogaHive({ enabled: true, token: hiveToken.value(), usage: true })],
});

export const graphql = onRequest({ secrets: [hiveToken] }, graphqlRequestHandler);

I get the following error because of the hiveToken.value() call during function deployment:

Error: Cannot access the value of secret "HIVE_TOKEN" during function deployment. Secret values are only available at runtime.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions