27 comments

I also had the same issue using JetBrains Rider.  I had an established project and when i came to add a http request file and a http-client-env.json file, the IDE was still unable to find the environment and it did not appear in the "Run with:" setting.

I was however able to get it to work by:

  • right clicking each file
  • Select "Tools > start index"

After that, I was able to select the environment.

You may be able to right click the folder they reside in rather than each file but i havent tried that.

So in my case it appeared to be how these files are indexed 🤷‍♂️

3

I've also got this problem in recent versions of IDE (IntelliJ IDEA 2021.1 and PyCharm 2021.1).
All of a sudden my requests that I used just a few days ago stopped working.
HTTP client fails with the "Invalid URI because of unsubstituted variable 'host'" message and neither of 3 suggested options works:

  1. "Add new environment file" doesn't let me to add "Regular" file, because it's already exists.
  2. "Add Variable To Existing Environment" doesn't work because there is "No configured environments".
  3. And "Run with environment" doesn't work because "There are no environments with variable 'host'".

The only workaround I found is to move the existing environment file to some other location, create a new environment file and copy the environment file content to the new file.

2

HI,

 

I've the same issue. In the past the editor worked well for me. 

It's looking like this:

I'm using:

IntelliJ IDEA 2020.1.2 (Ultimate Edition)
Build #IU-201.7846.76, built on June 1, 2020
Licensed to xxx
Subscription is active until November 2, 2020
Runtime version: 11.0.7+10-b765.53 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.5
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Non-Bundled Plugins: com.intellij.plugins.watcher, com.jetbrains.php, intellij.prettierJS, org.asciidoctor.intellij.asciidoc

 

But I've multiple variables configured:

 

In the last week I removed / disabled many plugins (but for sure not the "Http Client"). Not sure if it's related to the issue.

 

best regards

Matthias

1

I got a similar issue and it turns out I had a hidden character in my `http-client.env.json` file name. 

it was quite annoying to debug

1

Same here.

I have three *.http files in the same directory. (Let say foo.http and bar.http)

Two of them work as expected the third one does not.

---------

foo.http

GET https://{{url_host}}/{{url_path_prefix}}/foo

---------

bar.http

GET https://{{url_host}}/{{url_path_prefix}}/bar

---------

I could provide the same screenshot.

Error message: Invalid URI because of unsubstituted variable

However the variable autocomplete always works as expected after {{.

 

 

PhpStorm 2022.1 EAP
Build #PS-221.5080.66, built on March 24, 2022
Runtime version: 11.0.14.1+1-b2043.17 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.16.14-1-default

1

After some investigation I managed to get this to work by doing the following:

  1. Create a new http request in the root of my project.
  2. Clicked on ‘Add Environment to Public File’ and Add Environment to Private File', and saved the two files to the root of the project.
  3. Right click on both `http-client.env.json` and `http-client.private.env` files and select ‘Override File Type’.
  4. Select ‘Json’ as the file type.
  5. Close my request and re-open again.  

I think this issue might arise when the `.env files support` plugin is activated.  I suspect the plugin is finding `*.env.json` files and setting their type to `.env` files and not `.json`.  

 

1

Please provide the detailed problem description (what do your environment file and HTTP request look like, what errors can you see namely, etc)

0

Hey there, i am having the same issue.

I've been using http client request files for quite some time now in a certain project where i've been testing all API end points with them. I have added new variables before and it worked completely fine.
I wanted to add a new variable "refreshToken", but since i changed that variable (might be coincidence in timing), phpstorm won't read http environment var files anymore.

I have my request files in sub folders in the folder 'api-requests'. That folder contains the environment files.
$ ls -tR api-requests/

api-requests/:
auth cards me crash-report transactions accounts http-client.env.json http-client.private.env.json.dist http-client.env.json.dist http-client.private.env.json

api-requests/auth:
set-new-password.http forgot-password.http logout.http login.http login-fails.http refresh-token-fails.http refresh-token.http

etc...


If i click the button "Add Environment File" on top of the editor, a new file will be added directly in the sub directory where the request file is in. When i set up an environment with variables there now (just for testing purposes), they are also not read. 

This issue started appearing last week.
After that I even updated phpstorm (was using 2020.1, updated to 2020.2) but that sadly didnt solve the issue

 

There might be some invalid cache which causes the problem, but i have yet to find it.

Any help would be appreciated, I really liked not having to use postman! :)

 

PhpStorm 2020.2.2
Build #PS-202.7319.77, built on September 23, 2020
Licensed to XXX
Subscription is active until October 7, 2020
Runtime version: 11.0.8+10-b944.31 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.7.7-100.fc31.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 926M
Cores: 8
Registry: run.processes.with.pty=TRUE, debugger.watches.in.variables=false
Non-Bundled Plugins: Key Promoter X, String Manipulation, YAML/Ansible support, codes.rudolph.idea.cfg, com.intellij.ideolog, io.github.qeesung.component.HighlightBracketPair, name.kropp.intellij.makefile, de.espend.idea.php.phpunit, net.king2500.plugins.PhpAdvancedAutoComplete, de.espend.idea.php.toolbox, de.espend.idea.php.annotation, fr.adrienbrault.idea.symfony2plugin
Current Desktop: KDE

0

Works here, on 2020.2.2. Please check if the same problem happens in a brand new project. If it reoccurs - please share more data or examples of your requests

0

Try restarting your IDE after setting up the environment file.

It worked for me on Windows with a brand new project.

0

Broken for me as well as at 2020.2.2 and 2020.2.3.

I have a long-running project with an established `http-client.private.env.json` file in it that has worked fine for ages, but now it fails to load the environments when I go to run the commands.

My set-up is pretty simple — a single directory with a few .http files and a single *env.json file. The directory is not excluded. I'm on latest MacOS.

I've tried:

  1. Restarting the IDE
  2. Deleting and recreating the http-client.private.env.json file and restarting the IDE
  3. Using a http-client.env.json file instead (and restarting the IDE)
  4. Invalidate caches and restart

Seems broken to me. Any ideas?

Update: seems to work now for me. I can't make it break now and unfortunately I don't know what I did to fix it, so I don't know conclusively what it was. It will remain a mystery. 

0

Scott Davey you can send us your IDE logs archive (Help > Collect Logs and Diagnostic Data) via Help | Contact Support or via https://uploads.jetbrains.com/. We'll check if there are any HTTP client related errors.

0

Dimitry, I've uploaded 2020_10_19_RP6pPUb6HFimewH1 for you. 

0

Thanks! Unfortunately the logs didn't provide any insights on the problem.

I've submitted this as https://youtrack.jetbrains.com/issue/IDEA-253417 for a corresponding team to further look into.

0

Hi, I added a comment to https://youtrack.jetbrains.com/issue/IDEA-253417  which might be a cause.

0

I'm having the same issue with 2021.1 EAP 3. As you can see all files are in correct place.

0

The original problem is still not addressed, only 2 votes so far. It would help if you vote for it & leave your comments there.

0

Hello,
same issue here.

- JetBrains Rider 2021.3.3

- MAC OS


As the screenshot shows I can't add a http-client.env.json because it is there and, in this case, it contains the unsubstituted variable.
Nor is it found in the Env configuration (default: No Environment).

I would be really nice to get it fixed.

Everything works without unsubstituted variable

0

Same problem, using IntelliJ IDEA 2021.3.3 (Ultimate Edition) and macOS 11.6.5.

I have .http file located outside of project directory, http-client.env.json and http-client.private.env.json were automatically generated next to it. But when I open it with IntelliJ the environment is ignored. I move all files into project root directory and then it started to work. 

0

I was facing the same issue using WebStorm. The problem in my case was that the "Run Configuration" was missing the environment, even tho it was selected in the http request tab.

It is quite simple to reproduce it. Just create an empty project and a new HTTP client request with a variable.

When I tried to run the request in context, it failed because of a missing variable.

Here the generated configuration missing the environment.

However, once I ran it using the "Run All Requests in File" option, it worked.

And the previous generated configuration had the environment set, allowing me to run the request in context without any issue.

--

WebStorm 2022.1
Build #WS-221.5080.193, built on April 10, 2022
Runtime version: 11.0.14.1+1-b2043.25 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.4

0

Same problem (almost?).

Everything works only if request files (`*.http`) and environment files (`http-client*.json`) are directly in the project root directory. Request files from any sub-directories don't 'see' environments, even if these sub-directories have environment files.

Surprisingly, it sometimes does work well, when all http files are moved to a sub-directory, but only until IDE restart.

--

PhpStorm 2022.2.3
Build #PS-222.4345.15, built on October 5, 2022
Runtime version: 17.0.4.1+7-b469.62 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.10.151-1-manjaro
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 12
Registry:
    run.processes.with.pty=TRUE

Non-Bundled Plugins:
    com.intellij.ideolog (203.0.30.0)
    zielu.gittoolbox (212.9.9)
    de.espend.idea.php.annotation (8.2.3)
    deno (222.4345.14)
    fr.adrienbrault.idea.symfony2plugin (2022.1.235)
    ru.adelf.idea.dotenv (2022.2)

Current Desktop: KDE

0

Could be an another case of IDEA-253417, I think.

However, I was not able to reproduce it on my 2022.2.3 installation, environments work fine despite the files location. Is it also reproducible for you on a fresh new test project?

0

Thank you Apti Tids, your solution worked 👍👍👍.

This seems like a solid bug that jetbrains still have not addressed in JetBrains Rider 2022.3.2. 

0

I am facing this issue in the latest IntelliJ 2024.2 EAP. Here is the stacktrace for the error:

Unhandled exception in [StandaloneCoroutine{Cancelling}@685081ad, LimitedDispatcher@45ad2c05]

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'value' of com/intellij/httpClient/http/request/run/HttpRequestGlobalContext$HttpClientVariables.set must not be null
    at com.intellij.httpClient.http.request.run.HttpRequestGlobalContext$HttpClientVariables.$$$reportNull$$$0(HttpRequestGlobalContext.java)
    at com.intellij.httpClient.http.request.run.HttpRequestGlobalContext$HttpClientVariables.set(HttpRequestGlobalContext.java)
    at com.intellij.httpClient.http.request.run.js.graalvm.HttpClientGraalVmJsResponseHandler$execute$2$1.invokeSuspend$lambda$4$syncGlobals(HttpClientGraalVmJsResponseHandler.kt:77)
    at com.intellij.httpClient.http.request.run.js.graalvm.HttpClientGraalVmJsResponseHandler$execute$2$1.invokeSuspend(HttpClientGraalVmJsResponseHandler.kt:80)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1583)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelled}@685081ad, LimitedDispatcher@45ad2c05]
 

 

IntelliJ IDEA 2024.2 EAP (Ultimate Edition)
Build #IU-242.12881.66, built on May 29, 2024

Runtime version: 21.0.3+13-b453.2 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 14.4.1
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 18000M
Cores: 10
Metal Rendering is ON
Registry:
 debugger.new.tool.window.layout=true
 ide.experimental.ui=true
Non-Bundled Plugins:
 wu.seal.tool.jsontokotlin (3.7.4)
 org.intellij.plugins.dhall (0.0.3)
 com.jetbrains.jax.ws (242.12881.66)
 com.intellij.properties.bundle.editor (242.12881.22)
 Pythonid (242.12881.66)
 com.intellij.mermaid (0.0.22+IJ.232)
 intellij.jupyter (242.12881.66)
 com.dsoftware.ghtoolbar (2024.2.0)
 org.jetbrains.plugins.kotlin.jupyter (242.12881.66)
 com.intellij.lang.jsgraphql (242.12881.22)
 org.sonarlint.idea (10.6.2.78685)
 mobi.hsz.idea.gitignore (4.5.3)
Kotlin: 242.12881.66-IJ
 

0

Hey,

I was not able to reproduce it on the latest 2024.2 EAP build, env vars still work as expected in the HTTP client:

Would it be possible to collect logs (Help > Collect Logs) and submit a new YouTrack request, so the team responsible for the HTTP Client subsystem can take a closer look?
https://youtrack.jetbrains.com/newIssue 

 

0

Same issue here, recent PyCharm Pro, never occurred before. Andrew's solution above did the trick.

- There was no default JSON filetype association with those environment .json files for some reason (PyCharm suggested “text”).

- Instead of “overriding” the context menu offered to “associate” a filetype in my case.

- After associating, the context menu now offers to “override” the filetype.

- I also had to reopen the HTTP client file.

 

Permalink (just two comments above now): https://intellij-support.jetbrains.com/hc/en-us/community/posts/360008388599/comments/18550572246802

0

Please sign in to leave a comment.