question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not compatible with runtime config

See original GitHub issue

If 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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
drewbakercommented, Oct 2, 2020

That’s fire. I like it!

0reactions
Gomahcommented, Oct 3, 2020

@samturrell That would be great!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found