Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud deployment fails if root directory contains spaces #6465

Open
polamoros opened this issue May 13, 2024 · 8 comments · May be fixed by #7188
Open

Cloud deployment fails if root directory contains spaces #6465

polamoros opened this issue May 13, 2024 · 8 comments · May be fixed by #7188
Assignees
Labels
☁️ aws Related to Amazon Web Services support 🐛 bug Something isn't working good first issue Good for newcomers

Comments

@polamoros
Copy link
Contributor

polamoros commented May 13, 2024

I tried this:

create an empty directory with a name that includes spaces my directory

mkdir "my directory"

Create a wing test file:

//my directory/main.test.w

bring cloud;

let bucket = new cloud.Bucket();

test "Bucket is empty" {
  assert(bucket.list().length == 0);
}

and run wing test -t tf-aws main.test.w

This happened:

✔ Compiling main.test.w to tf-aws...

✔ terraform init

✖ terraform apply

Command failed: terraform apply -auto-approve
╷
│ Error: opening S3 object source (assets/Test78LWzuS1GQ_env0_testBucketisempty_Handler_Asset_9A744A14/966A2F55D4BD8FD662E1A92D8BB84CD9/archive.zip): open assets/Test78LWzuS1GQ_env0_testBucketisempty_Handler_Asset_9A744A14/966A2F55D4BD8FD662E1A92D8BB84CD9/archive.zip: no such file or directory
│
│   with aws_s3_object.Test78LWzuS1GQ_env0_testBucketisempty_Handler_S3Object_9FB2AC36,
│   on main.tf.json line 145, in resource.aws_s3_object.Test78LWzuS1GQ_env0_testBucketisempty_Handler_S3Object_9FB2AC36:
│  145:       }
│
╵

✔ terraform destroy


Tests 1 failed (1)
Snapshots 1 skipped
Test Files 1 failed (1)
Duration 0m23.74s

I expected this:

The test to pass.

Is there a workaround?

no

Anything else?

The test passes on the simulator

>_ wing test main.test.w

pass ─ main.test.wsim » root/env0/test:Bucket is empty

Tests 1 passed (1)
Snapshots 1 skipped
Test Files 1 passed (1)
Duration 0m0.30s

Wing Version

0.73.41

Node.js Version

v20.11.1

Platform(s)

MacOS

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@polamoros polamoros added the 🐛 bug Something isn't working label May 13, 2024
@skyrpex
Copy link
Contributor

skyrpex commented May 13, 2024

It worked to me, same version (0.73.41):

wing test -t tf-aws main.test.w


✔ Compiling main.test.w to tf-aws...

✔ terraform init

✔ terraform apply

✔ Setting up test runner...

✔ Running tests...

pass ─ main.test.tfaws.454176 » root/Test.OoU3q9EuIO/env0/test:Bucket is empty
✔ terraform destroy

✔ Snapshot main.test.w.tf-aws.snap.md...


Tests 1 passed (1)
Snapshots 1 new
Test Files 1 passed (1)
Duration 0m51.02s

@polamoros
Copy link
Contributor Author

it looks like it's happening if the root directory contains a space

@skyrpex
Copy link
Contributor

skyrpex commented May 13, 2024

Maybe we should file an issue anyway?

@Chriscbr Chriscbr reopened this May 13, 2024
@Chriscbr
Copy link
Contributor

I'm able to repro this. Running wing test "dir with spaces/main.w" is fine but wing test -t tf-aws "dir with spaces/main.w" fails with the aforementioned error.

@Chriscbr Chriscbr added the ☁️ aws Related to Amazon Web Services support label May 13, 2024
@Chriscbr Chriscbr changed the title Can not run a new test on tf-aws Cloud test fails if root directory contains spaces May 13, 2024
@staycoolcall911 staycoolcall911 added the good first issue Good for newcomers label May 21, 2024
@revitalbarletz
Copy link
Contributor

@srinumadhavv it is all yours :)

@revitalbarletz revitalbarletz self-assigned this May 26, 2024
@skyrpex
Copy link
Contributor

skyrpex commented May 27, 2024

wing compile fails for @thoroc, too, if there's spaces in the cwd.

@thoroc
Copy link

thoroc commented May 27, 2024

Yes unfortunately MacOS has those spaces in certain situations where node tries to use a path on /Users/<USER>/Library/Application Support/ during compile time. In my case, this is due to be using github.com/Schniz/fnm. I have tried to have a peruse at the code for the compile subcommand, but I think it is calling code outside this part of the source code.

Of course the path could be put between quotes or the space escaped to solve this issue, from what I understand.

@Chriscbr
Copy link
Contributor

Chriscbr commented Jul 3, 2024

Another user ran into this while compiling on Windows (the parent directory of their project had spaces, causing either compilation to fail or deployment to AWS to fail). Link to the discussion on discord: https://discord.com/channels/1096077994994442281/1258078911749820436

@Chriscbr Chriscbr added this to the Winglang Stable Release milestone Jul 3, 2024
@Chriscbr Chriscbr changed the title Cloud test fails if root directory contains spaces Cloud deployment fails if root directory contains spaces Jul 3, 2024
@tsuf239 tsuf239 assigned tsuf239 and unassigned revitalbarletz Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☁️ aws Related to Amazon Web Services support 🐛 bug Something isn't working good first issue Good for newcomers
Projects
Status: 🤝 Backlog - handoff to owners
Development

Successfully merging a pull request may close this issue.

7 participants