mdanics / fluttergram

A fully functional Instagram clone written in Flutter using Firebase / Firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] pls help

asmglr opened this issue · comments

I get this error message. I checked the getfeed url correctly. Where's the trouble?

[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Unexpected character (at line 2, character 1)
E/flutter (20332):
E/flutter (20332): ^
E/flutter (20332):
E/flutter (20332): #0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1394:5)
E/flutter (20332): #1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1261:9)
E/flutter (20332): #2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:926:22)
E/flutter (20332): #3 _parseJson (dart:convert-patch/convert_patch.dart:31:10)
E/flutter (20332): #4 JsonDecoder.convert (dart:convert/json.dart:505:36)
E/flutter (20332): #5 JsonCodec.decode (dart:convert/json.dart:153:41)
E/flutter (20332): #6 jsonDecode (dart:convert/json.dart:96:10)
E/flutter (20332): #7 _Feed._loadFeed (package:Fluttergram/feed.dart:68:7)
E/flutter (20332):
E/flutter (20332): #8 _Feed.initState (package:Fluttergram/feed.dart:20:10)
E/flutter (20332): #9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
E/flutter (20332): #10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (20332): #11 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #12 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #13 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (20332): #14 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #16 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (20332): #17 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (20332): #18 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (20332): #19 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (20332): #20 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #21 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #22 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (20332): #23 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #24 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #25 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5830:14)
E/flutter (20332): #26 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #27 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #28 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (20332): #29 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (20332): #30 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (20332): #31 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (20332): #32 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #33 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #34 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (20332): #35 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (20332): #36 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (20332): #37 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (20332): #38 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #39 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
E/flutter (20332): #40 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (20332): #41 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
E/flutter (20332): #42 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (20332): #43 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4481:5)
E/flutter (20332): #44 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4666:11)
E/flutter (20332): #45 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
E/flutter (20332): #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
E/flutter (20332): #47 Element.updateChild (package:flutt

@asmglr same here! did you found any solution for this?

When do you guys get this error? On startup? Any tips on how to reproduce this?

I/flutter: Failed invoking the getFeed function. Exception: FormatException: Unexpected character (at line 2, character 1)

^

Help me with this

try {
var request = await httpClient.getUrl(Uri.parse(url));
var response = await request.close();
if (response.statusCode == HttpStatus.ok) {
String json = await response.transform(utf8.decoder).join();
prefs.setString("feed", json);
List<Map<String, dynamic>> data =
jsonDecode(json).cast<Map<String, dynamic>>();
listOfPosts = _generateFeed(data);
result = "Success in http request for feed";
} else {
result =
'Error getting a feed: Http status ${response.statusCode} | userId $userId';
}
} catch (exception) {
result = 'Failed invoking the getFeed function. Exception: $exception';
}

Note:- last highlighted exception part is executing.

after using firebase funtions:log it's showing :-

2020-07-06T04:23:40.774935726Z D getFeed: Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions

2020-07-06T04:23:41.069Z E getFeed:
The behavior for Date objects stored in Firestore is going to change
AND YOUR APP MAY BREAK.
To hide this warning and ensure your app does not break, you need to add the
following code to your app before calling any other Cloud Firestore methods:

const firestore = new Firestore();
const settings = {/* your settings... */ timestampsInSnapshots: true};
firestore.settings(settings);

With this change, timestamps stored in Cloud Firestore will be read back as
Firebase Timestamp objects instead of as system Date objects. So you will also
need to update code expecting a Date to instead expect a Timestamp. For example:

// Old:
const date = snapshot.get('created_at');
// New:
const timestamp = snapshot.get('created_at');
const date = timestamp.toDate();

Please audit all existing usages of Date when you enable the new behavior. In a
future release, the behavior will change to the new behavior, so if you do not
follow these steps, YOUR APP MAY BREAK.
2020-07-06T04:23:43.020482084Z D getFeed: Function execution took 2246 ms, finished with status code: 500
2020-07-06T04:23:43.111Z E getFeed: Unhandled rejection
2020-07-06T04:23:43.111Z E getFeed: Error: 9 FAILED_PRECONDITION: The query requires an index. You can create it here: https://####.com
at Object.exports.createStatusError (/srv/node_modules/grpc/src/common.js:87:15)
at ClientReadableStream._emitStatusIfDone (/srv/node_modules/grpc/src/client.js:235:26)
at ClientReadableStream._receiveStatus (/srv/node_modules/grpc/src/client.js:213:8)
at Object.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:1256:15)
at InterceptingListener._callNext (/srv/node_modules/grpc/src/client_interceptors.js:564:42)
at InterceptingListener.onReceiveStatus (/srv/node_modules/grpc/src/client_interceptors.js:614:8)
at /srv/node_modules/grpc/src/client_interceptors.js:1019:24
2020-07-06T04:28:42.961683906Z D getFeed: Function execution started

Error: Can't set headers after they are sent.
at validateHeader (_http_outgoing.js:491:11)
at ServerResponse.setHeader (_http_outgoing.js:498:3)
at ServerResponse.header (/worker/node_modules/express/lib/response.js:767:10)
at ServerResponse.send (/worker/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/worker/node_modules/express/lib/response.js:267:15)
at ServerResponse.send (/worker/node_modules/express/lib/response.js:158:21)
at /srv/lib/getFeed.js:19:17
at Generator.next ()
at fulfilled (/srv/lib/getFeed.js:4:58)
at

Hi sorry for my absence.

Were you able to solve this issue?

Have the same problem. When u try to get the feed, you get a html document instead of a json file. But I can't find a solution but I try it.

app just keeps loading at homescreen no post is visible give a solution pls

@scarpex If you have the same issue, it looks like it's a Billing issue

Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions (from the previous comment )

@12tilak34 are you following anyone? do you / they have any posts?

@12tilak34 are you following anyone? do you / they have any posts?

yes I'm following and posts are also uploaded but it only gets load feed doesn't show up and I think it's because of billing issue cloud functions are not enable so post are not visible but with the help of listview and stream builder I solve that problem now everything works fine for me.

@12tilak34 glad you solved it. Are you able to document the steps you did to fix it? It seems like it could be related to #105

@12tilak34 glad you solved it. Are you able to document the steps you did to fix it? It seems like it could be related to #105

Yep bro I will do that for him ✌🏻🔥