Open azjgard opened 1 year ago
updated description and generated two bugs
The original issue showed 2 different issues #3251, #3252. After #3252 was closed as a duplicate of #457, we decided to close #3251 and keep this issue. I revised the issue's title and description to reflect all that.
Updated title
Hi,
This issue hasn't seen activity in 60 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!
Checked it now and the current status is quite the same:
Ran this:
bring cloud;
let api = new cloud.Api();
inflight class RequestController {
pub static inflight handleRequest(request: cloud.ApiRequest): cloud.ApiResponse {
return cloud.ApiResponse {
status: 200,
body: "Hello, world!"
};
}
}
api.get("/", RequestController.handleRequest);
Received this error:
error: Cannot reference an inflight value from within a preflight expression
--> bla.w:14:14
|
14 | api.get("/", RequestController.handleRequest);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Cannot reference an inflight value from within a preflight expression
Hi,
This issue hasn't seen activity in 60 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!
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!
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!
I tried this:
Given this starter code:
I moved the controller logic into a static method of a class:
And then tried to use that static method to handle requests:
This happened:
The following error was thrown during compilation:
I expected this:
I expected the console to compile and requests to be handled successfully.
Is there a workaround?
Don't use class methods for handling API requests, and define route controllers using anonymous inflight functions (like in the original code sample).
Component
Compiler
Wing Version
0.23.17
Wing Console Version
No response
Node.js Version
v20.3.1
Platform(s)
MacOS
Anything else?
Community Notes