Can't connect VSCode to IRIS4Health 2024.1
Hi
With this servers definition in VSCode:
Access to 2023.1.2 works just fine, 2024.1 stubbornly refuses to connect ("Unavailable at <time>", says "server could not be accessed by <user>" - I tried several users, all with the %All and %Development roles).
I can access the SMP just fine, even from the "Open Management Portal in External Browser" button in VSCode, which proves the configuration is correct. I can access the 2024.1 instance from Studio (2024.1) just fine, and the terminal works (for what it's worth). So all is good, except VSCode won't connect.
This is a plain vanilla, fresh install of 2024.1. I checked the CSP app definitions, I can see no difference from 2023.1. I checked resources, services, user privileges, etc. Nothing jumps out. And the instance works just fine as far as I can tell. The only difference is that 2023.1 is using the internal web server, 2024.1 is using an external Apache (no choice there in 2024). The Apache web server is a local XAMPP install, which I use for CSP, simple HTML, REST etc. I all works just fine. I compared the Web Gateway settings between 2023.1 and 2024.1, they are virtually identical.
I think I've exhausted my options here. Any ideas anyone?
Thanks in advance.
Comments
When you access IRIS Portal in your browser what is the url?
I'm guessing you need to add a `pathPrefix` property. See https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cl…
@John Murray
http://localhost/csp/sys/%25CSP.Portal.Home.zen
Same as for 2023.1 except for the port (one is 52773, the other the default 80)
Have you checked if the /api endpoints are enabled in webapplication?
Also have a look and check Security/Audit/View AuditDB for any errors. Same for ApacheLogs, webgateway logs(CSP.log) as well as the messages.log
Hi Timo
Thanks for your feedback. Yes, I checked all /api endpoints are enabled and their settings are identical to the 2023.1 instance (they are the installation defaults anyway). They are also declared and active in the web gateway.
Apache's access log gives me this: "HEAD /api/atelier/ HTTP/1.1" 404 - "-" "axios/1.7.2". There's nothing in Apache's error and other logs. I can't find any error in the web gateway's csp.log either. The audit database is clean.
The only thing remotely suspicious on the system is an error message repeated several times in the message log, related to the license server:
LMF Warning: Could not send login/logout messages to license server (unknown reason = -10|Unknown Server)
But since the portal, Studio and the terminal all work fine I see no reason for this to have any bearing on the issue. To be on the safe side, I changed the license server port and restarted the instance. I'm not seeing that error anymore (for now). But VSCode still won't connect.
The fact that VSCode is getting a 404 (and not a 400, 401, 403 or 5xx) is a bit strange, but I believe I've seen other instances where IRIS returns a 404 when, say, a 401 would make more sense, so I won't get hung up on this being a "not found" error.
FWIW, the InterSystems extension pack for VScode is updated regularly; it is currently on version 1.0.3.
/api is active in the Web Gateway Does Apache forward /api to the Web Gateway? Do you have something like the following in httpd.conf
<Location /api/>
CSP On
</Location>
Sorry, I had not seen your answer when I responded to John. That was the problem indeed. Thanks for the feedback!
Hi Alexander, I have exactly the same issue described here by Oliver but I'm using IIS with CSP gateway instead of external Apache. And so far, whatever I tried I cannot make the vs code work against my local IRISHealth 2024.1. My configuration in settings.json is
"intersystems.servers": {
"cit1k64": {
"webServer": {
"host": "localhost",
"port": 443,
"scheme": "https"
},
"description": "Local IRIS Server"
}
},
and I can open the portal in external browser from vs code
but vs code is stating "Server could not be accessed by 'Unknown User' or by any user I try to add in the settings file
I have in csp.ini
[APP_PATH:/]
and
[APP_PATH:/csp]
defined
I tried defining
[APP_PATH:/api]
but no difference
What would be the equivalent of apache <Location /api/> CSP On </Location> in IIS ?
thank you
Dean
Hi Dean.
Please check if it works via http, not https. I wonder if the certificate configuration is the issue
In IIS -- create /api web-application if it does not exist, and add handler mapping for "*" files to CSPms module
Hi Alexander, thanks, it works over http, now I'm wandering how could I have not tried it myself.
I think by adding [APP_PATH:/api] in csp.ini the /api webapp got created automatically in IIS
I see it in IIS manager and the CSPms is also inherited handler for "*"
thanks a lot
cheers
Dean
One more piece of info: out of desperation, I tried to change the port on my Apache server, restarted it. Everything works fine on the new port (I tried 8080 and 52774), VSCode (after changing the settings, naturally) still won't connect. So using the default HTTP port is not the issue.
Maybe the trace facility on the Web Gateway Management page will yield clues.
Good point, I'll try that next. Thanks!
The plot thickens... After activating traces (v9r), I don't see anything being logged on the HTTP trace of the csp GW for VSCode's attempts to access the instance. I do see all the traces for accessing the management portal. It must be something with VSCode's configuration then, but I can't figure out what; after all InterSystems server configuration is very trivial... I restarted VSCode again to be safe, still no cigar. And I can open the SMP in an external browser from VSCode, so the server connection settings must be correct. "Open management portal in tab" does nothing, which is perhaps also significant? (the /csp/sys* apps "use cookie for session" are all on "autodetect", FWIW)
I even tried to disable the windows firewall (since it's all local I don't expect that could be a cause, but you never know...), to no avail.
Here's one way to verify from VS Code (but independent of the InterSystems ObjectScript extension) that the /api/atelier REST APIs are available on that server.
- Start a new VS Code window (no workspace open)
- In Extensions view, use the filter @id:humao.rest-client to find and install the REST Client extension.
- From the File menu create a New Text Document, setting its language to http.
- Paste this content:
GET http://localhost/api/atelier/v1/%25SYS HTTP/1.1 Authorization: Basic _system:SYS
Now click on the "Send Request" codelens that appears above the first line.
Hi John
I got a 404 again, but then that gave me an epiphany... I realized that the /api path did not have "CSP On" on httpd.conf. Added it, restarted Apache, all works! ☺
Too bad there's no IRIS installation tool for Apache on Windows as far as I know(or any Windows-specific documentation for connecting Apache to IRIS, for that matter) - but anyway, problem solved!
Many thanks for your support!
Hi @Olivier Caudron
Has this question resolved your issue, I am also facing the same issue with connecting to 2024.1
Would help if anything as resolved this issue.
Regards,
Harshitha
Is your /api/atelier web application enabled?
Is your web server configured correctly to forward that endpoint to IRIS?
Did you try the steps I suggested at https://community.intersystems.com/post/cant-connect-vscode-iris4health…?