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

Failed to bundle function: [object Object] when passing map from preflight to inflight #3119

Closed
tsuf239 opened this issue Jun 28, 2023 · 2 comments · Fixed by #3825
Closed
Assignees
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler

Comments

@tsuf239
Copy link
Contributor

tsuf239 commented Jun 28, 2023

I tried this:

test on sim:

bring cloud;

// NOT WORKING
let m1 = Map<str> {
    "a a": "b", 
  };

test "test 1" {
  log(m1.get("a a"));
}

// WORKING
let m2 = Map<str> {
    "a": "b", 
  };

test "test 2" {
  log(m2.get("a"));
}


// WORKING
test "test 3" {
  let m3 = Map<str> {
    "a a": "b", 
  };

  log(m3.get("a a"));
}

This happened:

when a map has a key that includes a space, it throws this error when the map is in the preflight:
image
Error: Failed to bundle function: [object Object]

when it doesn't include space or is found within the inflight scope it's working.

I expected this:

to work with no errors

Is there a workaround?

placing the map in the inflight scope

Component

Compiler

Wing Version

0.22.31

Wing Console Version

No response

Node.js Version

No response

Platform(s)

MacOS

Anything else?

No response

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.
@tsuf239 tsuf239 added the 🐛 bug Something isn't working label Jun 28, 2023
@staycoolcall911 staycoolcall911 added the 📜 sdk-spec-impl Appears in the SDK spec roadmap label Jun 28, 2023
@Chriscbr Chriscbr added 🛠️ compiler Compiler 📜 sdk-spec-impl Appears in the SDK spec roadmap and removed 📜 sdk-spec-impl Appears in the SDK spec roadmap labels Aug 2, 2023
@Chriscbr
Copy link
Contributor

Chriscbr commented Aug 2, 2023

I encountered this as well. It looks like the examples originally posted are working for me (after updating them to the latest map syntax with "=>"), but here is a new example where it fails to bundle when I run wing compile -t tf-aws main.w:

bring cloud;

let headers = {
  "my-fancy-header" => "my-fancy-value"
};

let api = new cloud.Api();
api.get("/hello", inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
  return cloud.ApiResponse {
    status: 200,
    headers: headers,
    body: "Hello, world!"
  };
});

@MarkMcCulloh MarkMcCulloh self-assigned this Aug 15, 2023
@mergify mergify bot closed this as completed in #3825 Aug 15, 2023
mergify bot pushed a commit that referenced this issue Aug 15, 2023
Fixes #3119

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.25.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🛠️ compiler Compiler
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants