Using AWS as a Back End: Authentication & API | raywenderlich.com

Learn how to use Amazon Web Services (AWS) to build a back end for your iOS apps with AWS Amplify and Cognito, using GraphQL.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/12931711-using-aws-as-a-back-end-authentication-api

In the step: amplify api update

No AppSync resource to update. Use the "amplify add api" command to update your existing AppSync API.
The "path" argument must be of type string. Received type undefined

Looks like we have to amplify add api first

hi guys, I have an issue when running

amplify api update

and running the shell script after building, it basically updates AWS cognito with the User schema inserted in schema.graphql, but after the build the schema.graphql schema reverts back to this

type Task @model {
id: ID!
title: String!
description: String
status: String
}
type Note @model {
 id: ID!
content: String!
}

The build output shows it did run the script I added as per the tutorial

PLATFORM_DEVELOPER_APPLICATIONS_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications
export PLATFORM_DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin
export PLATFORM_DEVELOPER_LIBRARY_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library
export

Found amplify-cli version: (e[0m4.40.1e[0m), Required: >= (4.22.0)
Found amplify-app version: (2.20.5), Required: >= (2.17.1)
Using: npx amplify-app
modelgen is set to true, generating Swift models from schema.graphql…
e[33me[39m
e[33mThe following types do not have ‘@auth’ enabled. Consider using @auth with @modele[39m
e[33m - Usere[39m
e[0mLearn more about @auth here: https://docs.amplify.aws/cli/graphql-transformer/directives#authe[0m
e[0me[0m
e[32me[39m
e[32mGraphQL schema compiled successfully.e[39m

e[32mEdit your schema at /Users/myMac/tutorialsAWSAsABackendAuthenticationAndAPI/starter/amplify/backend/api/amplifyDatasource/schema.graphql or place .graphql files in a directory at /Users/myMac/tutorialsAWSAsABackendAuthenticationAndAPI/starter/amplify/backend/api/amplifyDatasource/schemae[39m
e[0mSuccessfully generated models. Generated models can be found in /Users/myMac/tutorialsAWSAsABackendAuthenticationAndAPI/starter/amplify/generated/modelse[0m
:white_check_mark: Amplify setup completed successfully.
:white_check_mark: Found Amplify CLI version 4.40.1
:guitar: Creating base Amplify project
:white_check_mark: Amplify setup completed successfully.
:white_check_mark: Successfully created base Amplify Project

  • Fetching updates to backend environment: dev from the cloud.
    :heavy_check_mark: Successfully pulled backend environment dev from the cloud.

e[0mCurrent Environment: deve[0m

e[90m|e[39me[0m Category e[0me[90m|e[39me[0m Resource name e[0me[90m|e[39me[0m Operation e[0me[90m|e[39me[0m Provider plugin e[0me[90m|e[39m
e[90m|e[39m -------- e[90m|e[39m ----------------- e[90m|e[39m --------- e[90m|e[39m ----------------- e[90m|e[39m
e[90m|e[39m Api e[90m|e[39m amplifyDatasource e[90m|e[39m Update e[90m|e[39m awscloudformation e[90m|e[39m
e[90m|e[39m Auth e[90m|e[39m starter11db0d15 e[90m|e[39m No Change e[90m|e[39m awscloudformation e[90m|e[39m
e[33me[39m
e[33mThe following types do not have ‘@auth’ enabled. Consider using @auth with @modele[39m
e[33m - Taske[39m
e[33m - Notee[39m
e[0mLearn more about @auth here: https://docs.amplify.aws/cli/graphql-transformer/directives#authe[0m
e[0me[0m
e[32me[39m
e[32mGraphQL schema compiled successfully.e[39m

e[32mEdit your schema at /Users/myMac/tutorialsAWSAsABackendAuthenticationAndAPI/starter/amplify/backend/api/amplifyDatasource/schema.graphql or place .graphql files in a directory at /Users/myMac/tutorialsAWSAsABackendAuthenticationAndAPI/starter/amplify/backend/api/amplifyDatasource/schemae[39m

  • Uploading files…
  • Updating resources in the cloud. This may take a few minutes…

this shows it did this process twice, uploading the USe graphQL schema I entered, but then went back and downloaded from the cloud the Task and Note schema, , and it did an overwrite in the xcode project after this on the schema.graphql .

Any idea whats going on?

Got an error : Cannot find type : ‘User’ in scope. Is it part of a library or Framework ? I haven’t found it in the code and in Combine.