awslabs / aws-mobile-appsync-sdk-ios Goto Github PK
View Code? Open in Web Editor NEWiOS SDK for AWS AppSync.
Home Page: https://awslabs.github.io/aws-mobile-appsync-sdk-ios/
License: Other
iOS SDK for AWS AppSync.
Home Page: https://awslabs.github.io/aws-mobile-appsync-sdk-ios/
License: Other
Describe the bug
When you send two mutations, one right after the other, a callback will get called for one of them, but not for the other one.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The callback should be called twice, once for each mutation that was sent.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
If you wait for the first mutation to complete, then call the second everything works as expected. This was working fine in a previous version of app sync, I have not yet identified which version it broke in.
Hi,
The podspec needs an update for SQLite.swift.
SQLite.swift 0.11.4 -> SQLite.swift 0.11.5
Describe the bug
Memory leak continuously occurred when using AppSyncClient (especially when invokes mutation)
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
Add any other context about the problem here.
Tested recently that the mutation is fast, but subscription call back took about 1 minute to fire even I'm sure that the mqtt clients already connected
is Carthage support planned ? If not would you accept PR ?
Whenever my app entered background, I cancelled all the subscriptions in background to reduce the network traffic. When app went to foreground again, I would re-subscribe them. But What I found is: this is a very heavy process. If there are more than 20 subscribers(which is possible for a chat app), it takes time to cancel them all. If I went to foreground immediately before all subscribers finished their cancelation works, the app's UI will be blocked for a while. I have to wait for all of them finish the cancelation to avoid blocking the ui.
For short, if I entered background then back to foreground quite fast and there are about 20 subscribers, the cancelations and subscriptions might happen simultaneously, which blocks the UI. I also checked the cancel method, seems like it has a very heavy workload although it's not an async method. I tried to print and find that all the 20 cancelations will take about 5-7 seconds to finish. Would be very appreciated if you could provide me some help. By the way, I've applied the pull request #28 and #34 to my own fork so I'm not sure whether this issue happened in the original repo. I cannot revert back because I have some of my own commits which expose the connection state to the user of the app.
Do you know some way to handle subscription success connection?
I was made some changes in AWSAppSyncSubscriptionWatcher
to handle this, but maybe you know better way
private func startSubscription() {
let semaphore = DispatchSemaphore(value: 0)
self.performSubscriptionRequest(completionHandler: { [weak self] (success, error) in
if let error = error {
self?.resultHandler(nil, nil, error)
}
semaphore.signal()
+ if let handle = self?.completeHandler {
+ self?.handlerQueue.async {
+ handle()
+ }
+ }
})
semaphore.wait()
}
The query with argument within optimistic update closure will fail with "missingValue" message.
The query is paginated.
Version of AppSync:
2.6.18
Message I'm getting:
Error at path "listJobsByCustomer.nextToken": missingValue
Mutation:
updateJob(input: UpdateJobInput!): Job
Query called in optimistic update closure:
listJobsByCustomer(customerId: String, first: Int, after: String): JobConnection
JobConnection:
type JobConnection {
items: [Job]
nextToken: String
}
Code:
let mutation = UpdateJobMutation(input: input)
appSyncClient?.perform(mutation: mutation, optimisticUpdate: { (transaction) in
do {
// Update our normalized local store immediately for a responsive UI
let query = ListJobsByCustomerQuery(customerId: "customerId", limit: 1)
try transaction?.update(query: query) {
(data: inout ListJobsByCustomerQuery.Data) in
for i in 0..<(data.listJobsByCustomer?.items)!.count {
if data.listJobsByCustomer?.items?[i]?.id == input.id {
data.listJobsByCustomer?.items?[i]?.status = input.status!
}
}
}
} catch let exception {
print("UpdateJobMutation Error updating the cache with optimistic response: \(exception.localizedDescription)")
}
}) { (result, error) in
if let error = error as? AWSAppSyncClientError {
print("Error occurred: \(error.localizedDescription )")
return
}
if let res = result {
print("UpdateJobInfo result: \(res)")
}
self.handleNetworkStateOnResult(online: true)
}
I configured appsync in apnortheast1 region and a lambda function in apsoutheast1. I selected 'create role' with the role automatically created. After that I got such error on client side:
❤️ ERROR errs: [The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 403; Error Code: AccessDeniedException; Request ID: bdd72051-4e81-11e8-bf27-7b4058a38dfb)
I tried to invoke a function created in apnortheast1 too with no problem.
Describe the bug
I have a case where I have to fire mutations every few seconds. In a case when there are over 2 mutations and you go to background and then back to foreground the app is being deadlocked permanently (main thread is locked). The only way to fix the deadlock is to completely remove the app from the device and then install again.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Shouldn't deadlock
Environment(please complete the following information):
Device Information (please complete the following information):
It's not related to the amount of subscribers, It's about the num of kinds of subscribers subscribe at the same time
Describe the bug
We were sending some base64 encoded data as a field in a resolver and found this issue after noticing that the data was truncated/corrupt.
To Reproduce
Steps to reproduce the behavior:
In a resolver request mapping (ours is just a none data source) send a long string like this:
#set($template = {
"field1": "foo",
"field2": "bar",
"auditsExtensions": "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222244444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444455555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555566666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777"
})
{
"version": "2017-02-28",
"payload": $util.toJson($template)
}
Response mapping:
$util.toJson($context.result)
Expected behavior
Either a documented size limit or no truncation.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
Any short term hints/workarounds would be greatly appreciated as we're working against a deadline. Happy to work on a patch if needed.
Thanks...
I am following the following tutorial to upload s3 images along with other message details to my s3 bucket using appsync:
https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-ios.html
The example is using a resolver for a dynamoDB datasource. How can I correctly setup the resolver when using a lambda function as my datasource (amazon aurora). This is presently my resolver which works fine for inserting data in my data source but does not upload the image data file to my s3 bucket:
{
"version": "2017-02-28",
"operation": "Invoke",
"payload": {
"field": "createMessage",
"arguments": $utils.toJson($context.arguments)
}
}
Also what is the localUri? and how is that different from the localUrl string that I can use to identify my file locally?
When installing with Carthage I get this error.
Incompatible Swift version - framework was built with 4.0.2 (swiftlang-900.0.69.2 clang-900.0.38) and the local version is 4.1 (swiftlang-902.0.48 clang-902.0.37.1).
Are there any plans to update the repo to Swift 4.1 soon?
A sample code like below:
let watcher1 = appsyncClient.subscribe(aTopic)
,watcher2 = appsyncClient.subscribe(anotherTopic)
//wait for a while
logout() //logout will do something like watcher1.cancel(), watcher2.cancel()
when I start to call subscribe function, appsync will initialise a watcher. The problem is. If I call the 'cancel' method before mqtt connection state become connected/connecting or others, the watchers are not released.
The watchers are only able to be released if the connection status chanaged to a non-notobservable state
Describe the bug
Working with lambda resolvers (specifically with golang), returning errors are correctly returned to the client when working with mutations, but not with queries.
Handler Signature
func Handler(ctx context.Context, req map[string]interface{}) (SomeObjType, error)
appSync?.perform(mutation: someMutation) {result, err in
The above will return the error object in result.errors
of a mutation, however:
appSync?.fetch(query: someQuery) {result, err in
Will return the errors neither in result or err.
Resolver mapping in both cases:
$util.toJson($context.result)
Expected behavior
Errors returned by lambda should go somewhere when fetching.
Environment(please complete the following information):
With every request that I'm making with AppSync, I receive a warning telling me that the operation is being executed on the main thread. I'm passing in DispatchQueue.main
as the queue for all these requests, yet I'm still consistently seeing the warning.
Ok, so i'm struggling with this case:
i have a query that does "get info about the current user". It doesn't take an id as a parameter, instead depends on the users context.identity.cognitoIdentityId (iam auth).
The problem i have is: if you do that call, i believe it is caching the response, then if i sign out and sign back in (as a different user), i get the old user's information when i do the same call.
Perhaps i can play with the cache keys (so it contains the user id in it)? - i'm not sure how to set this:
appSyncClient?.apolloClient?.cacheKeyForObject = { $0["id"] }
I didn't see documentation for this method, but maybe i'm missing it?
Alternatively - it would be great to just expose appSyncClient.store.clearCache (i think this is a thing here: https://github.com/apollographql/apollo-ios/blob/master/Sources/Apollo/ApolloStore.swift)
Sorry if i'm not making sense - I'll be happy to go into more detail if needed.
After pod install, the error is the following:
pod install
Analyzing dependencies
[!] Unable to find a specification for AWSAppSync (~> 2.6.7)
[!] Automatically assigning platform ios with version 10.0 on target EventsApp because no platform was specified. Please specify a platform for this target in your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform
.
I think the readme should be updated too.
Describe the bug
When run the app got crashed about SQLite
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
Add any other context about the problem here.
Hi
Could you please provide a best practice example on how to create the config file for user pools. Presently I am passing self on app delegate as the argument and conforming to the protocol to get the token but not sure if this is the way to go or to create a new class. Thanks.
In AppDelegate
let appSyncConfig = try AWSAppSyncClientConfiguration(url: AppSyncEndpointURL, serviceRegion: AppSyncRegion, userPoolsAuthProvider: self)
self.appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig)
let user = pool.currentUser()
user?.getSession().continueOnSuccessWith(block: { (task) -> Any? in
let getSessionResult = task.result
self.idToken = getSessionResult?.idToken?.tokenString
return nil
})
extension AppDelegate: AWSCognitoUserPoolsAuthProvider {
func getLatestAuthToken() -> String {
if idToken != nil {
return idToken!
} else {
return ""
}
}
}
We're planning to use AppSync in our iOS app. But I have an issue with updating dependencies, since that our project uses new version of ReachabilitySwift, when AppSync uses older.
I checked imports of ReachabilitySwift and didn't find it.
So I suggest to remove it from podspec.
Hi AppSync team,
It's a common use case that we would need to upload original media file along with thumbnail file.
Really hope we have this feature supported!
Thanks
Thread 6: Fatal error: 'try!' expression unexpectedly raised an error: database is locked (code: 5) in SQLLite after a mutation
The exception occurs in the merge function when we try to perform many mutation in less than a second
public final class AWSSQLLiteNormalizedCache: NormalizedCache {
public init(fileURL: URL) throws {
db = try Connection(.uri(fileURL.absoluteString), readonly: false)
try createTableIfNeeded()
}
public func merge(records: RecordSet) -> Promise<Set<CacheKey>> {
return Promise { try mergeRecords(records: records) }
}
public func loadRecords(forKeys keys: [CacheKey]) -> Promise<[Record?]> {
return Promise {
let records = try selectRecords(forKeys: keys)
let recordsOrNil: [Record?] = keys.map { key in
if let recordIndex = records.index(where: { $0.key == key }) {
return records[recordIndex]
}
return nil
}
return recordsOrNil
}
}
Currently I have my subscription code in viewDidload. The app's subscription won't work if app was in background for a few minutes the back to foreground. But I'm still able to fire mutation actions. How should I handle the reconnection to make the subscription work again?
Wondering if there is a sanctioned way to mock out data responses from the server so we can implement UI Tests against that mock data.
I've tried a couple different approaches so far. The first is setting up a custom URLSessionConfiguration with a Mock URL Cache that just returns mock data whenever the URL cache is checked by the URLSession. I haven't quite gotten this to work yet, and it seems a bit hacky, but is a possible solution.
The other thing I'm thinking about trying is modifying the AWSAppSyncClientConfiguration to expose the ApolloCache so our application can inject a custom ApolloCache implementation that returns mock data. This seems to be the preferred way of mocking data in Apollo (apollographql/apollo-ios#188)
The second approach would require a modification to the AppSync framework. I'd be happy to submit a PR for this, but wanted to make sure there wasn't some other approach I haven't considered yet.
State your question
Optimistic update always fail to "missingValue", if model wasn't previously cached from a fetch query. And said fetch operation needs to actually populate the cache with items, for further optimistic updates, otherwise (i.e. cache is empty) the optimistic update won't update/initialize the cache(?)
Don't know how could I initialize an empty cache just in case the first mutation fails to reach backend, and needs to be written on cache/localDB
Environment(please complete the following information):
Device Information (please complete the following information):
what is the best workflow to use in order to send push notifications to an iOS device when using appsync.
I have a chat app and want users to receive push notifications from apns when they are not using the app and a message is sent to them.
I have all the certificates and have successfully sent push notifications from the sns console. I don't know however how to integrate that with appsync.
My thoughts are to use a lambda function to send the notification directly when an appsync message is sent but could not find any examples on how to do that.
Describe the bug
When using the CachePolicy.returnCacheDataElseFetch while Querying, a call is never made to the NetworkTransport class to return data even though the cache does not have a value for this Query yet. This happens when you have already completed a different query first.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
If there has not been a query for that data yet, then it should fetch that data from the server and return instead of just returning nil from the cache
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
Everything works properly in 2.6.21, this issue only shows up when I upgrade my dependency to 2.6.22.
If you view the comments below, this bug has been isolated to a change in the Apollo GraphQLExecutor. commit c417b11
Additionally tests have been written in the comments below that demonstrate this issue.
So according to the docs I should be able to set
let appSyncConfig = try AWSAppSyncClientConfiguration(url: AppSyncEndpointURL,
serviceRegion: AppSyncRegion,
credentialsProvider: credentialsProvider,
databaseURL:databaseURL,
s3ObjectManager: AWSS3TransferUtility.default())
However when attempting to set this with the user pool as in
let appSyncConfig = try AWSAppSyncClientConfiguration.init(url: AppSyncEndpointURL, serviceRegion: AppSyncRegion, userPoolsAuthProvider: CognitoUserPoolsAuthProvider(pool: pool), urlSessionConfiguration: URLSessionConfiguration.default, databaseURL: databaseURL, connectionStateChangeHandler: nil, s3ObjectManager: AWSS3TransferUtility.default() as! AWSS3ObjectManager, presignedURLClient: nil)
It will just complain that Could not cast value of type 'AWSS3TransferUtility' (0x114bb1830) to 'AWSAppSync.AWSS3ObjectManager' (0x114bb1858).
How do I create the s3ObjectManager to pass in?
Describe the bug
Even if you call cancel () on AWSAppSyncSubscriptionWatcher, Memory is not released.
To Reproduce
I am creating a chat application
I was using the same UIViewController in several rooms
When entering the room Initialize with
messageWatcher?.cancel()
messageWatcher = nil
And instantiating subscription with
messageWatcher = try appSyncClient.subscribe
As I enter the room many times, the number of instances continues to increase,
Memory usage will continue to increase
Looking at Xcode's Debug Memory Graph, it is as follows
Please tell me if there is a solution.
Environment(please complete the following information):
Device Information (please complete the following information):
Additional context
It would be good to expose the detailed connection states to public so that user can choose to manually fetch the missing messages between the disconnect-to-connected time window. Eg: Connecting, Connected, Not Observable(might be 'connecting' too although might not be observable), Disconnected etc.
I've used appsync as a chat app, thus I have to observe the connection status for each conversation, I tried to fork this repo and exposed the connection status to my main app,
As shown below, I have two conversations with dialog ids 10028 and 10029. I have made two subscriptions for each of them, as you can see from the log, 10028 subscribed first, but it keep connecting even it was connected before.
11:23:07 💙 INFO all connection status: [""]
11:23:07 💙 INFO all connection status: ["", ""]
11:23:08 💙 INFO all connection status: ["", "10028-connecting..."]
11:23:09 💙 INFO all connection status: ["", "10028-connected"]
11:23:15 💙 INFO all connection status: ["", "10028-connecting..."]
11:23:15 💙 INFO all connection status: ["10029-connecting...", "10028-connecting..."]
11:23:16 💙 INFO all connection status: ["10029-connected", "10028-connecting..."]
11:23:16 💙 INFO all connection status: ["10029-connected", "10028-connected"]
If there are more than 2 conversations, I found that one connected conversation will keep changing from connected to connecting then to connected again during other subscribers' connection status changes. Do you have any idea about this? Appreciated if you could provide me some help!
Hi,
while working on #28 crash fix pointed in #39, I noticed that AppSyncMQTTClient
strongly holds all MQTTSubscritionWatcher
instances in topicSubscribersDictionary
. The only way to remove those instances is to call stopSubscription(subscription:)
passing the watcher in the argument. This could be a desired behaviour, but it conflicts with AWSAppSyncSubscriptionWatcher
, which is the only implementation of MQTTSubscritionWatcher
protocol, calling stopSubscription(subscription:)
on deinit
. In this approach It's impossible to have the execution of deinit
without first releasing the reference in AppSyncMQTTClient
by calling stopSubscription(subscription:)
explicitly, and then having it called again by deinit
.
Is the S3Object available in AppSync (see Complex objects section in https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-ios.html) tied to dynamoDB, or could it be used with a Lambda datasource (say one connecting to a mongoDB)?
Hi,
Reading thought the documentation and code, i can't find a way to disable the offline stuff. My client is pretty simple and this complexity is mucking it up.
Current behavior:
Making a network call to AppSync while offline does not invoke callback, presumably this is buffered somewhere?
Desired behavior:
Making a network call to AppSync while offline fails - an error message is sent to callback
Thanks for considering this.
-Michael
I'm getting a fatal error trying to run my new mutation:
stack trace:
#6 0x0000000105995fd8 in AWSMutationCache.saveMutationRecord(record:) at /Users/michael/fun/sketchaphone/Pods/AWSAppSync/AWSAppSyncClient/AWSSQLLiteNormalizedCache.swift:89
#7 0x000000010598f31c in MutationExecutor.queueMutation(mutation:) at /Users/michael/fun/sketchaphone/Pods/AWSAppSync/AWSAppSyncClient/AWSOfflineMutationStore.swift:187
#8 0x000000010596f920 in PerformMutationOperation.init(offlineMutationRecord:client:appSyncClient:offlineExecutor:mutation:handlerQueue:mutationConflictHandler:resultHandler:) at /Users/michael/fun/sketchaphone/Pods/AWSAppSync/AWSAppSyncClient/AWSAppSyncClient.swift:541
#9 0x000000010596d988 in PerformMutationOperation.__allocating_init(offlineMutationRecord:client:appSyncClient:offlineExecutor:mutation:handlerQueue:mutationConflictHandler:resultHandler:) ()
#10 0x000000010596d3d0 in AWSAppSyncClient.perform<A>(mutation:queue:optimisticUpdate:conflictResolutionBlock:resultHandler:) at /Users/michael/fun/sketchaphone/Pods/AWSAppSync/AWSAppSyncClient/AWSAppSyncClient.swift:484
#11 0x0000000104c7469c in GamesManager.joinGame(delegate:) at /Users/michael/fun/sketchaphone/sketchaphone/API/GamesManager.swift:233
I'm sure i could be going something wrong, but i'm unclear what it is - and it probably shouldn't crash my app.
My lambda job (which backs the mutation) isn't logging anything so i'm assuming isn't getting executed. My other mutation is working.
my app code is here:
https://github.com/michaeleconomy/sketchaphone
Hey all,
This is a follow up to question I posted on the AWSAppSync forums and StackOverflow (links at bottom), which has some more detail on permissions and resolvers, but I'll summarize why I don't think that's an issue, and update the question here.
Basically, my app requires offline support, which AppSync provides almost perfectly, except for the file upload to an S3 bucket. I cannot get it to upload automatically. I intend to use User Pools, as that is my app's authentication method, but I have tried using IAM as well and cannot get the files to automatically upload. If I use S3TransferManager.default() and manually make the upload request using either authentication method, it succeeds every time, so I believe my permissions are correct. The S3Object is also added as an item attribute in DynamoDB as such:
"pdf": "{\"s3\":{\"key\":\"example.pdf\",\"bucket\":\"#####\",\"region\":\"us-west-2\"}}"
I set breakpoints in your AppSync code to check if the call to upload ever happens, and it doesn't seem to. This seems to be because, in line 508 in AWSAppSyncClient.swift (AppSync 2.6.15 using codegen w/ s3 wrapper argument), the check
if self.mutationRecord.type == .graphQLMutationWithS3Object { ...
always fails, so
appSyncClient.performMutationWithS3Object(...)
is not called, but instead
appSyncClient.send(...)
is called.
After a query, I am also able to successfully use
guard let s3Object = exampleThing?.pdf?.fragments.s3Object else { return }
appSyncClient?.s3ObjectManager?.download(s3Object: s3Object, toURL: fileURL!, completion: { (success, error) in
...
}
to download example.pdf (if I upload it to the S3 bucket myself, of course).
I followed your tutorials and created the S3Object type and S3ObjectInput in the schema, connected the appropriate resolvers, and it would seem set the right permissions. Do you guys know what I'm doing wrong here? Why is mutationRecord.type == .graphQLMutationWithS3Object not returning true or, more generally, why is the automatic upload to S3 not happening?
Currently, I've just created my own offline solution that uploads the files I need to S3 when Reachability goes from .none to either wifi or cellular, but it would be ideal if the upload was handled by AppSync at the same time it does the offline mutation.
Any ideas? Thanks!
PS: Also, and this could just be a breakpoint thing, mutationRecord.type shows up as <invalid>
to my debugging window, while the other variables are 'some', etc. And mutationRecord.s3ObjectInput is 'none' (this breakpoint was set during a CreateThingMutation, after checking mutationRecord.type fails, inside the 'else' statement that calls appSyncClient.send(...)).
AWS AppSync Forum question:
https://forums.aws.amazon.com/message.jspa?messageID=847113
S.O. question:
https://stackoverflow.com/questions/50050340/aws-appsync-unable-to-upload-s3object-to-bucket-automatically-with-cognito-use
I have been trying to use the appsync service using user pools for authentication but cannot setup the configuration correctly.
I want to use:
let appSyncConfig = try AWSAppSyncClientConfiguration(url: AppSyncEndpointURL, serviceRegion: AppSyncRegion, userPoolsAuthProvider: CognitoUserPoolsAuthProvider(pool: pool))
But I get: use of unresolved identifier 'CognitoUserPoolsAuthProvider'
and if I use AWSCognitoUserPoolsAuthProvider(pool: pool) the error is:
'AWSCognitoUserPoolsAuthProvider' cannot be constructed because it has no accessible initializers
How can I set the configuration correctly to use user pools with appsync?
Describe the bug
When building with Carthage the version of Reachability that is being downloaded is 3, but the sdk binary attempts to use functions from v4
dyld: Symbol not found: _$S12ReachabilityAAC24allowsCellularConnectionSbvpWvd Referenced from: /private/var/containers/Bundle/Application/54737AA0-D181-4133-830C-E863D0AA335B/Pear-DEV.app/Frameworks/AWSAppSync.framework/AWSAppSync Expected in: /private/var/containers/Bundle/Application/54737AA0-D181-4133-830C-E863D0AA335B/Pear-DEV.app/Frameworks/Reachability.framework/Reachability in /private/var/containers/Bundle/Application/54737AA0-D181-4133-830C-E863D0AA335B/Pear-DEV.app/Frameworks/AWSAppSync.framework/AWSAppSync
Environment(please complete the following information):
Additional context
The problem seems to be the version specified in Cartfile (specified to be compatible with v 0.4.0). Needs an update to the latest
I am trying my hands on with AppSync iOS and want to get a failure callback for a fetch query when the internet is not available.
When the internet is available, the following code outputs both "sending" and "receiving". But when the internet is not available, I do not get any callback from AppSync client. The code only outputs "sending".
`print("sending")
self.appSyncClient?.fetch(query: getCategoriesQuery, cachePolicy: .fetchIgnoringCacheData) { (result, error) in
print("receiving")
if let error = error as? AWSAppSyncClientError {
print("Error getting Categories from AppSync API: \(error.localizedDescription )")
}
else {
print("Result - ", result?.data?.getCategories?.items!)
}
}`
After the network timeout, the xCode console outputs
"HTTP load failed (error code: -1001 [1:60])"
"finished with error - code: -1001"
How can I handle the network failure here? Any help is appreciated.
I'm looking to contribute with a couple of PRs, but just want to clarify what the current state of testing is with regards to PRs and if there's anything going on behind the scenes to improve this? I've seen the AWSAppSyncClientTests
group, but it's empty at present.
Thanks.
Hi there,
I would like to get a chance to support automatically uploading multiple S3 files. Currently, as my schema, I have a field: files: [S3ObjectInput]
, but seems the SDK doesn't support a list of objects like that. I was able to get it worked with one object: file: S3ObjectInput
.
Any ideas will be very much appreciated.
Thanks.
When app sleep 10 minutes and come back to foreground I receive log like below
2018-09-21 10:44:31.248292+0900 [AppDelegate.swift:118] applicationWillResignActive - 【applicationWillResignActive】
2018-09-21 10:44:31.856556+0900 [AppDelegate.swift:133] applicationDidEnterBackground - 【applicationDidEnterBackground】
2018-09-21 11:03:57.213634+0900 [AppDelegate.swift:123] applicationWillEnterForeground - 【applicationWillEnterForeground】
2018-09-21 11:03:57.231934+0900 [] nw_socket_get_input_frames recvmsg(fd 5, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232051+0900 [] nw_socket_get_input_frames recvmsg(fd 27, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232086+0900 [] nw_socket_get_input_frames recvmsg(fd 29, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232137+0900 [] nw_socket_get_input_frames recvmsg(fd 30, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232166+0900 [] nw_socket_get_input_frames recvmsg(fd 31, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232197+0900 [] nw_socket_get_input_frames recvmsg(fd 32, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232224+0900 [] nw_socket_get_input_frames recvmsg(fd 40, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232251+0900 [] nw_socket_get_input_frames recvmsg(fd 42, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232278+0900 [] nw_socket_get_input_frames recvmsg(fd 44, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232311+0900 [] nw_socket_get_input_frames recvmsg(fd 45, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232378+0900 [] nw_socket_get_input_frames recvmsg(fd 47, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232454+0900 [] nw_socket_get_input_frames recvmsg(fd 52, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232491+0900 [] nw_socket_get_input_frames recvmsg(fd 53, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232525+0900 [] nw_socket_get_input_frames recvmsg(fd 54, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232576+0900 [] nw_socket_get_input_frames recvmsg(fd 55, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232619+0900 [] nw_socket_get_input_frames recvmsg(fd 56, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232677+0900 [] nw_socket_get_input_frames recvmsg(fd 57, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232708+0900 [] nw_socket_get_input_frames recvmsg(fd 58, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.232735+0900 [] nw_socket_get_input_frames recvmsg(fd 59, 1024 bytes) [57: Socket is not connected]
2018-09-21 11:03:57.234904+0900 TIC Read Status [13:0x0]: 1:57
2018-09-21 11:03:57.234926+0900 TIC Read Status [13:0x0]: 1:57
2018-09-21 11:03:57.235710+0900 [PinRoomsController.swift:538] prepareOnDeleteRoomObserver() - ...discomplete
2018-09-21 11:03:57.236290+0900 [GroupRoomsController.swift:1052] prepareOnDeleteManualRoomObserver() - Error occurred: AWSAppSyncSubscriptionError(additionalInfo: Optional("Subscription Terminated."), errorDetails: Optional(["status": "5", "recoverySuggestion": "Restart subscription request.", "failureReason": "Disconnected from service."]))
It's look like socket is disconnected. Do you know good solution for this situation?
When building with Carthage, the AWSAppSync build script fails. It looks to be in relation to some Cocoapods dependencies.
I have removed the /Users/joelbell/Library/Caches/org.carthage.CarthageKit
folder and the Carthage/
folder from my project and I still see this issue.
This is my Carthage update command:
carthage update --platform ios --color auto --no-use-binaries
Below is a portion of the error log that is relevant.
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/joelbell/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/aws-mobile-appsync-sdk-ios/2.6.15/Build/Intermediates.noindex/ArchiveIntermediates/AWSAppSync/IntermediateBuildFilesPath/AWSAppSyncClient.build/Release-iphoneos/AWSAppSync.build/Script-4E996121F39BA74DB553A2CB.sh
cd /Users/joelbell/dev/SIC/abx-sic-operator/Carthage/Checkouts/aws-mobile-appsync-sdk-ios
/bin/sh -c /Users/joelbell/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/aws-mobile-appsync-sdk-ios/2.6.15/Build/Intermediates.noindex/ArchiveIntermediates/AWSAppSync/IntermediateBuildFilesPath/AWSAppSyncClient.build/Release-iphoneos/AWSAppSync.build/Script-4E996121F39BA74DB553A2CB.sh
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/joelbell/Library/Caches/org.carthage.CarthageKit/DerivedData/9.3_9E145/aws-mobile-appsync-sdk-ios/2.6.15/Build/Intermediates.noindex/ArchiveIntermediates/AWSAppSync/IntermediateBuildFilesPath/AWSAppSyncClient.build/Release-iphoneos/AWSAppSync.build/Script-4E996121F39BA74DB553A2CB.sh
(1 failure)
Ported from issue opened by @jamesknowsbest: https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios/issues/9
When adding a new event, the event was created in dynamoDB with eventid of 'f1b75cc2-4894-4f62-a1a4-2d4215d4025f' correctly, however the app stored '1B2C20C4-8832-40BF-B933-8CDBC98798CD' in it's local memory for that event for one reason or another
this means when adding comments to that event, it saves it in the DB with eventid of '1B2C20C4-8832-40BF-B933-8CDBC98798CD' which is an event that does not exist
as shown in the screenshots, the bottom two events do not appear as there is no associated eventid, however the top comment with the correct eventID does work
that was created after closing the app, and re-opening it
As far as I can tell, this happens because of where the app makes a UUID for the commentid table before processing the result of the query[1]. It then ignores the view and doesn't refresh it so the code which starts listening for new events doesn't fire[2].
[1] https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios/blob/4ae387fdf6db962d7aa547e5fd9d1dd434c581d5/EventsApp/AddEventViewController.swift#L54
[2 ]https://github.com/aws-samples/aws-mobile-appsync-events-starter-ios/blob/4ae387fdf6db962d7aa547e5fd9d1dd434c581d5/EventsApp/AddEventViewController.swift#L70-L72
When you have several watchers for the one topic the app will crash trying to cancel the subscription
The problem lies in the line of the code that modifies array while iterating on it regarding the upper loop. Here is the case:
for i in 0..<self.topicSubscribersDictionary[topic]!.count {
if watcherToRemove.getIdentifier() == subscription.getIdentifier() {
// remove that watcher for no further notification
self.topicSubscribersDictionary[topic]!.remove(at: i)
}
}
In addition I have a concern: as long as there is no enforcing of a single thread and self.topicSubscribersDictionary can be modified (until it's really ensured not) from the background thread thus making the whole code of stopSubscription to crash due to force unwrapping in many places.
P.s. I made a PR just to provide a solution example
Hi All,
Had fun and games with this one today, if I use a query and one of my parameters is a float it is not saving correctly in the cache. I finally managed to fix this by turning my float into a string but I seem to be the only person having this issue. Strange enough the float was in the format 363638, perhaps it needs more help in thinking its a float? The number was too long to be an int.
When I look in the SQLite DB the Query_Root key entry never puts my query in its record. Fixed this by making my parameter a string.
Thanks
Hi I am reopening an issue discussed previously (#25). I followed the updated instructions (https://awslabs.github.io/aws-mobile-appsync-sdk-ios/#complex-objects) to a tee and still experienced no success with automatically uploading to S3. I can see that there is an S3Object in my dynamoDB table but nothing gets uploaded to my S3 bucket. I tried uploading the same file using TransferUtility and it works, so I'm not sure what the issue is.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.