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

cant lift objects from a custom platform #5836

Closed
eladcon opened this issue Mar 3, 2024 · 3 comments
Closed

cant lift objects from a custom platform #5836

eladcon opened this issue Mar 3, 2024 · 3 comments
Labels
🐛 bug Something isn't working 👠 platforms Issues relating to Wing Platform Providers

Comments

@eladcon
Copy link
Collaborator

eladcon commented Mar 3, 2024

I tried this:

write a custom platform for the awscdk target

// my-custom-platform/index.js
// this folder also has a package.json with @winglang/platform-awscdk as a dependency
const { Function } = require("@winglang/platform-awscdk/lib/function.js");
const {FUNCTION_FQN} = require("@winglang/sdk/lib/cloud");
module.exports.Platform = class Platform {
  newInstance(type,scope,id,props) {
    if (type === FUNCTION_FQN) {
      return new Function(scope, id, props);
    }
  }
}

compile a wing app with both platforms
CDK_STACK_NAME=test wing compile -t @winglang/platform-awscdk -t ../my-custom-platform/index.js main.w

// main.w
// this folder also has a package.json with @winglang/platform-awscdk as a dependency
bring cloud;

let b = new cloud.Bucket();

new cloud.Function(inflight () => {
  b.get("a");
});

This happened:

Error: buckets can only be bound by tfaws.Function for now

(the tfaws.Function is just a typo)

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

No response

Node.js Version

No response

Platform(s)

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.
@eladcon eladcon added 🐛 bug Something isn't working 👠 platforms Issues relating to Wing Platform Providers labels Mar 3, 2024
Copy link

github-actions bot commented Jun 2, 2024

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

Copy link

github-actions bot commented Sep 1, 2024

Hi,

This issue hasn't seen activity in 90 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@Chriscbr
Copy link
Contributor

Chriscbr commented Sep 6, 2024

This error shouldn't be raised anymore since we've now defined a more general purpose "isAwsInflightHost" function -- see the check here:

if (!AwsInflightHost.isAwsInflightHost(host)) {
throw new Error("Host is expected to implement `IAwsInfightHost`");
}

and the implementation here:

public static isAwsInflightHost(obj: any): obj is IAwsInflightHost {

I've opened a separate issue for making sure we add this API for all of the major cloud targets: #7081

@Chriscbr Chriscbr closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 👠 platforms Issues relating to Wing Platform Providers
Projects
Status: Done
Development

No branches or pull requests

3 participants