Not compatible with runtime config
See original GitHub issueIf using an env variable for the endpoint
value, this value needs to be provided at built time and cannot be dynamically updated later. The nuxt Runtime Config aims to solve this problem, by giving you access to a $config
object where the correct config variables are provided.
I have this working locally by updating the plugin.js
to contain the following:
import { GraphQLClient } from 'graphql-request';
if (<%= options.useFetchPolyfill %>) {
require('cross-fetch/polyfill');
}
export default (ctx, inject) => {
const clientOptions = <%= serialize(options.options) %>;
const client = new GraphQLClient(ctx.$config.API_URL || '<%= options.endpoint %>', clientOptions);
// Inject the graphql client to the context as $graphql
ctx.$graphql = client;
inject('graphql', client);
};
Config variable can be updated to something else if required. Happy to PR my changes if they work for you.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
.NET Runtime config options - .NET | Microsoft Learn
Learn how to configure the .NET runtime using configuration settings.
Read more >Document that runtime configuration can't be used ... - GitHub
When I set the value of a publicRuntimeConfig property from an environment variable, ... Runtime config is not compatible w/ prerendering
Read more >next.config.js: Runtime Configuration
Runtime configuration won't be available to any page (or component in a page) without being server-side rendered.
Read more >Getting invalid runtime for javaSE-16 error in vscode
Invalid runtime for JavaSE-16: Runtime at '/usr/lib/jvm/java-16-jdk' is not compatible with the 'JavaSE-16' environment. I tried every other ...
Read more >HOW TO FIX Minecraft "Your Java Runtime is ... - YouTube
HOW TO FIX Minecraft "Your Java Runtime is Incompatible " Java 16 1.16.1. Watch later. Share. Copy link. Info. Shopping. Tap to unmute....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s fire. I like it!
@samturrell That would be great!