aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
185 stars 62 forks source link

platform-core import issue when running app #2235

Open jtweeks opened 6 days ago

jtweeks commented 6 days ago

Environment information

System:
  OS: macOS 14.5
  CPU: (8) x64 Intel(R) Core(TM) i7-8557U CPU @ 1.70GHz
  Memory: 197.95 MB / 8.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
  Yarn: undefined - undefined
  npm: 10.8.3 - ~/.nvm/versions/node/v18.19.1/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.5.0
  @aws-amplify/backend: 1.7.0
  @aws-amplify/backend-auth: 1.4.0
  @aws-amplify/backend-cli: 1.4.2
  @aws-amplify/backend-data: 1.2.0
  @aws-amplify/backend-function: 1.7.5
  @aws-amplify/backend-output-schemas: 1.4.0
  @aws-amplify/backend-output-storage: 1.1.3
  @aws-amplify/backend-secret: 1.1.5
  @aws-amplify/backend-storage: 1.2.2
  @aws-amplify/cli-core: 1.2.0
  @aws-amplify/client-config: 1.5.2
  @aws-amplify/deployed-backend-client: 1.4.2
  @aws-amplify/form-generator: 1.0.3
  @aws-amplify/model-generator: 1.0.9
  @aws-amplify/platform-core: 1.2.0
  @aws-amplify/plugin-types: 1.4.0
  @aws-amplify/sandbox: 1.2.5
  @aws-amplify/schema-generator: 1.2.5
  aws-amplify: 6.8.2
  aws-cdk: 2.166.0
  aws-cdk-lib: 2.167.0
  typescript: 5.0.4
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Describe the bug

Error: node_modules/@aws-amplify/platform-core/lib/package_json_reader.d.ts:1:8 - error TS1192: Module '"/Users/joseweeks/Documents/WebApps/villadelsol/node_modules/zod/index"' has no default export.

import z from 'zod';

Reproduction steps

I do have my front end and backend as separate projects and git repos. Did an angular 'npm run start' in local dev environment

Can be fixed by updating import to: import type * as z from 'zod';
in package_json_reader.d.ts

ykethan commented 6 days ago

Hey @jtweeks, thank you for reaching out. To reproduce this issue could you provide us some additional information. Are you experiencing this issue when using the Data client in your application?

jtweeks commented 6 days ago

Correct, I followed the multiple teams steps.  I am on Angular 16, typescript 5.0.? for the front end, latest amplify on backend.  This is the only issue I am seeing when trying to build and run the front end, and if I update the import line in node modules it goes away, but that won’t work when deployed since it will pull the original package from npm.Sent on the go by JoseOn Nov 15, 2024, at 2:12 PM, Kethan sai @.***> wrote: Hey @jtweeks, thank you for reaching out. To reproduce this issue could you provide us some additional information. Are you experiencing this issue when using the Data client in your application?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

jtweeks commented 6 days ago

By the way everything else is working.  I was able to import the aws-sdk to call a lambda function in the sandbox but I can’t use the Client due to that import error.  Thx for the assistanceSent on the go by JoseOn Nov 15, 2024, at 2:12 PM, Kethan sai @.***> wrote: Hey @jtweeks, thank you for reaching out. To reproduce this issue could you provide us some additional information. Are you experiencing this issue when using the Data client in your application?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

ykethan commented 2 days ago

Hey @jtweeks, apologies on the delay. I was not able to reproduce this issue, could you provide us a minimal reproduction steps or link to a Github repo that would help us in diving into this issue.

jtweeks commented 2 days ago

I believe this issue stems from using 2 different projects, with different typescript versions. My front end is using Angular 16 and typescript 5.0.? the backend project is using 5.6.? and amplify 6.8.?. All I did was point to the schema in the backend project from the front end, and the issue happens when it tries to resolve all the dependencies. Do I have to use a schema with the client? Can I use other clients, and will they authenticate? thanks