pulumi-azure-native: Typescript Crashing
What happened?
Typescript keeps on crashing and is stuck on Initializing JS/TS language features a bug was opened on the Typescript repo as well already, but I believe that it might be interesting to add Pulumi to it as Pulumi is the cause due the huge number of dependencies that are being loaded.
Currently, Typescript is NOT usable until this gets resolved as type suggestion is not working.
More info: https://github.com/microsoft/TypeScript/issues/50809
Steps to reproduce
This demonstrates the issue (after a while, while working with it and trying to get command completion, reproduced on Mac and Windows through WSL)
import * as pulumi from "@pulumi/pulumi/index.js";
import * as resources from "@pulumi/azure-native/resources/index.js";
export const glbLocation = config.get("glb-location");
export const glbProjectName = config.get("glb-project-name");
export const glbProjectEnv = config.get("glb-project-env"); // prd, stg, dev, tst, tmp, ...
// ======================================================================
// Create the main Resource Group
// ======================================================================
const resourceGroup = pulumi.all([glbLocation, glbProjectName, glbProjectEnv]).apply(([glbLocation, glbProjectName, glbProjectEnv]) => {
return new resources.ResourceGroup(`rg-${glbProjectName}-${glbProjectEnv}-`, {
location: glbLocation
});
})
Expected Behavior
Working type suggestions
Actual Behavior
Crashing TS language features
Output of pulumi about
CLI
Version 3.40.0
Go Version go1.19
Go Compiler gc
Host
OS ubuntu
Version 20.04
Arch x86_64
Additional context
Tested on Linux and Mac and neither are working
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you’ve opened one already).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 22 (4 by maintainers)
setting
typescript.tsserver.maxTsServerMemoryto4096in VS code seems to solve this problem for meHi! Sorry, completely forgot about this over the holidays etc etc. Here’s my current script. It’s not the prettiest piece of code I’ve written in my career, but hopefully I’ll be able to explain.
So in short, this script will loop over all folders in the
@pulumi/azure-nativepackage and subsequently delete all folders not explicitly marked in themodulesToKeepvariable. This is of course possible to make more dynamic but as this just lurks in our repo, it’ll stay the same until we decide to include another package.If the module is going to be kept, it will find all version folders inside that module and perform the same replacement script in there.
The exported function is used by an index file in our case which is executed via command line, but you’re free to do whatever suits your use case best. I decided to write it in TypeScript to be in the same format as all our other non .NET code, but it should be fairly simple to turn this into regular JavaScript as the only types present are a few input variables.
The final exported function is a desperate attempt to make things go a little bit quicker by utilizing promises for each folder and execute them in parallel.
Hopefully this will help you all out!
This is specifically for type information in the editor
Hello, Any news regarding this issue? I’m experiencing it and it slows
pulumi upsubstantially since addingazure-nativeand the vscode project itself is barely usable. Would happily provide debug logs.Hello,
just wanted to share an improved version of @Ankvi adapted to 2 of our needs :
The packageModulesToKeep have the following format :
The full script can be seen here : https://gist.github.com/antoine-lecomte/db85d01ad2e57d5e786a68f8d5294a99
I created a version of @Ankvi’s script for my purposes, cleaning up a couple things and making it automatically run after npm install. To use it, follow these instructions:
scripts/postinstall-cleanup.ts: https://gist.github.com/joeskeen/fe3081a088653140171e4bc55a579134Also logged an issue with VSCode but it turned out to be because of @pulumi/azure-native
I tried Ubuntu, Windows, VSCode, VSCode insiders… crashed my project no matter what I did. IMHO this package is unusable until the issue is resolved. Not sure why it doesn’t seem to be a priority.
see https://github.com/microsoft/vscode/issues/173434
I don’t know if VS Code has made some improvements recently but it has been working quite well for me. I have one project that’s using
1.78.0and another1.88.0versions of the SDK, both seem to be working fine. I am on VS Code version1.74.0that was released recently. I’ve been using it on both Win 11 and macOS (M1). In previous versions, I could barely open a file or two before the LSP crashed and I would have to reload the editor. I’ll update this comment as I continue to use VS Code over the next few days on both platforms.