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
Unable to resolve "@aws-amplify/backend" from "amplify/data/resource.ts" #1493
Comments
I have tried clearing all caches, clearing package lock, tried yarn, installing the @aws-amplify/backend directly etc. Nothing can get this package to show up. |
Hello again, @ChristopherGabba 👋. I'm going to send this one over to the |
Hi @ChristopherGabba, this looks like the |
Hey @edwardfoyle! You are Maxs old roommate right?? I've known Max since I was like 4 and grew up with him. Small world... He says you are a demon on a bicycle. Anyway, hope you are doing well. I am only seeing it when I search for "@aws-amplify/backend" it only shows up: In package.json and yarn.lock and then the backend config. Note I have package-lock.json and yarn-lock.json because I was trying npm vs. yarn. That's not typical. |
Yes I am! Small world indeed :) Are you importing anything from import type { Schema } from '../amplify/data/resource' instead of import { Schema } from '../amplify/data/resource' This ensures that the Schema type import is erased from the transpiled js |
@edwardfoyle that's awesome. If your going to be at his wedding, we will meet there! Anyway, yes I placed quite a bit of types that I made in the For instance I have a: MediaType: a.enum(["Video", "Image"]) And I made a copy right above it: enum MediaType {
...
} And I'm referencing it throughout my app. Is there a way to reference your enums through the Schema type? Also do I even need to have that @aws-amplify/backend package in my app? I think you may be spot on, I'll go through and clean it up and let you know if it fixes it! |
@edwardfoyle Okay, you were spot on, I had two files where I imported Schema without the |
I was able to eliminate this error by fixing my imports throughout my app, thank you @edwardfoyle! I do recommend placing some sort of emphasis on the importance of this in the docs as these did get autoimported this way while typing |
Yeah this is a good call. Definitely an easy thing to miss. I'll bring it up with the product team. |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, GraphQL API, DataStore
Amplify Version
v6
Amplify Categories
auth, storage, hosting
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
I am trying to run an amplify gen 2 backend for my react-native-expo (managed workflow) app and I cannot get app to compile.
I keep getting the error:
Expected behavior
I should be able to get the app to compile but it isn't.
Reproduction steps
Code Snippet
File Structure:
Log output
aws-exports.js
Here is my amplify_outputs.json
Manual configuration
No response
Additional configuration
No response
Mobile Device
iPhone 12 Physical
Mobile Operating System
iOS 17.2.1
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: