winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.05k stars 198 forks source link

@winglibs/cognito file not found: "./aws-utils.ts" #6086

Closed ekeren closed 7 months ago

ekeren commented 7 months ago

I tried this:

npm i @winglibs/cognito 
bring cognito;
wing run 

This happened:

An error has occurred:
Failed to compile.

error: File not found: "./aws-utils.ts"
    --> node_modules/@winglibs/cognito/platform/tfaws.w:133:3
    |
133 |   extern "./aws-utils.ts" static pub inflight _signUp(clientId: str, email: str, password: str): void;
    |   ^^^^^^^^^^^^^^^^^^^^^^^ File not found: "./aws-utils.ts"

error: File not found: "./aws-utils.ts"
    --> node_modules/@winglibs/cognito/platform/tfaws.w:134:3
    |
134 |   extern "./aws-utils.ts" static pub inflight _adminConfirmUser(poolId: str, email: str): void;
    |   ^^^^^^^^^^^^^^^^^^^^^^^ File not found: "./aws-utils.ts"

error: File not found: "./aws-utils.ts"
    --> node_modules/@winglibs/cognito/platform/tfaws.w:135:3
    |
135 |   extern "./aws-utils.ts" static pub inflight _initiateAuth(clientId: str, email: str, password: str): str;
    |   ^^^^^^^^^^^^^^^^^^^^^^^ File not found: "./aws-utils.ts"

error: Symbol "Cognito" has multiple definitions in "/private/tmp/demo-simtools/node_modules/@winglibs/cognito/platform"
  --> main.w:3:1
  |
3 | bring cognito;
  | ^^^^^^^^^^^^^^ Symbol "Cognito" has multiple definitions in "/private/tmp/demo-simtools/node_modules/@winglibs/cognito/platform"

I expected this:

to work

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

ekeren commented 7 months ago

@Chriscbr in version 0.0.3 the ts issue is resolved, but I still have a problem:

An error has occurred:
Failed to compile.

error: Symbol "Cognito" has multiple definitions in "/private/tmp/demo-simtools/node_modules/@winglibs/cognito/platform"
  --> main.w:2:1
  |
2 | bring cognito;
  | ^^^^^^^^^^^^^^ Symbol "Cognito" has multiple definitions in "/private/tmp/demo-simtools/node_modules/@winglibs/cognito/platform"

error: Unknown symbol "cognito"
   --> main.w:12:16
   |
12 | let auth = new cognito.Cognito(api);
   |                ^^^^^^^ Unknown symbol "cognito"
Chriscbr commented 7 months ago

Oof... yeah the compiler should be catching these errors before we publish the library. I'll try to fix and open a bug for the compiler (also need one for the ts issue)

ekeren commented 7 months ago

What is the root cause for this?

ekeren commented 7 months ago

Oh, I see @eladcon has 2 pub class under the same directory with name Cognito

Chriscbr commented 7 months ago

Fixed in cognito 0.0.4

I've opened this issue for the symbol conflict error (compiler bug) https://github.com/winglang/wing/issues/6087