graphql-hive / graphql-hive/console

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

Open
#4,172 4 comments 0 reactions 0 assignees View on GitHub
improvement libraries sdk
Dominant language
TypeScript
Stars
483
Forks
145
Avg merge
2d 5h
Merged PRs (30d)
65

Description

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:

```ts
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.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.