-
Notifications
You must be signed in to change notification settings - Fork 49
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
[bug]: flutterfire configure
throws if too many projects
#150
Comments
Try this solution #27 (comment) |
I tried that, however, in this case, it seems that there is a limit on the JSON string that can be obtained from the firebase command. |
Same here. Filtering on the project ID has no effect either |
I have exactly the same issue. This is quite a blocker. This needs to be fixed! |
@russellwheatley @Salakar This happens from both my Linux machine and macOS machine. So it is platform-independent. I cannot urge, how critical this bug is. It completely disables our company to use it on any of our projects. The whole EDIT: The issue will be probably here in reading the stdout:
|
hmmmm, I've just created a JSON file with the output received from Sample with 3600+ lines of dummy projects {
"status": "success",
"result": [
{
"projectId": "wwwwwwwwwwwwwwwwwwwwwwwwwwww",
"projectNumber": "34905345345",
"displayName": "wwwwwwwwwwwwwwwwwwwwwwwwwwww",
"name": "projects/wwwwwwwwwwwwwwwwwwwwwwwwwwww",
"resources": {
"hostingSite": "wwwwwwwwwwwwwwwwwwwwwwwwwwww"
},
"state": "ACTIVE",
"etag": "wwwwwwwwwwwwwwwwwwwwwwwwwwww"
}
]
} I made a "called.dart" file like so: import 'dart:io';
void main(List<String> args) async {
final String fileContent = await File('./large.json').readAsString();
stdout.write(fileContent);
} Which I call from this "caller.dart" script which mimics the logic used when calling import 'dart:convert';
import 'dart:io';
void main(List<String> args) async {
final result = await Process.run(
'dart',
['called.dart'],
runInShell: true,
);
final output = result.stdout.toString();
final commandResult = Map<String, dynamic>.from(
const JsonDecoder().convert(output) as Map,
);
print(commandResult);
} It works fine, I cannot recreate this issue. Does anyone have a repro I could use? |
Is someone who has this problem able to test this PR for me? #203 You will need to:
Would be a great help. Thanks! |
I tried it but I'm still running into the issue
|
Thanks for checking @guidezpl! when you run this command, what is happening?
presumably you get a JSON response with a Also - what machine are you running this on? |
Right, with a list of all projects I have access to (in a large organization)
This on a mac. Is there a "piping" limit? Because the actual line count is closer to 3000
i.e. this copies 1978 lines to the clipboard
|
Excellent work, @guidezpl, I've just created 2 different executable scripts from the command line and placed in my one in nodejs: #!/usr/bin/env node
const generateJSON = () => {
const dataList = [];
for (let i = 0; i < 400; i++) {
dataList.push({
projectId: `flutterfire-e2e-tests-${i}`,
projectNumber: '866672724757',
displayName: `flutterfire-e2e-tests-${i}`,
name: `projects/flutterfire-e2e-tests-${i}`,
resources: {
hostingSite: `flutterfire-e2e-tests-${i}`,
storageBucket: `flutterfire-e2e-tests-${i}.appspot.com`,
locationId: 'europe-west2',
},
state: 'ACTIVE',
etag: '1_e518b189-c486-4e4e-a83f-2f12207343c4',
});
}
const output = {
status: 'success',
result: dataList,
};
console.log(JSON.stringify(output, null, 2));
};
generateJSON(); and another in Dart: #!/usr/bin/env dart
import 'dart:convert';
import 'dart:io';
void main() {
final List<Map<String, dynamic>> dataList = [];
for (int i = 0; i < 400; i++) {
dataList.add({
'projectId': 'flutterfire-e2e-tests-$i',
'projectNumber': '866672724757',
'displayName': 'flutterfire-e2e-tests-$i',
'name': 'projects/flutterfire-e2e-tests-$i',
'resources': {
'hostingSite': 'flutterfire-e2e-tests-$i',
'storageBucket': 'flutterfire-e2e-tests-$i.appspot.com',
'locationId': 'europe-west2',
},
'state': 'ACTIVE',
'etag': '1_e518b189-c486-4e4e-a83f-2f12207343c4',
});
}
final Map<String, dynamic> output = {
'status': 'success',
'result': dataList,
};
stdout.write(jsonEncode(output));
} They both output JSON responses with over 5000 lines. I used another dart script to execute them both and received the valid JSON response from both. It seems to me to be a problem with the Firebase CLI not responding with the full, valid JSON response. This correlates with your output as well. If you're expecting a JSON response from Could you do one last thing, @guidezpl. Could you copy/paste the response from that command and put into a JSON validator like: https://jsonformatter.org/ and confirm the output is corrupted? If it is, this is an issue on the Firebase CLI and I will raise it there. Thanks 👍 |
The output from I'm not familiar with bash but could firebase be chunking its output stream? That would explain it appearing correct in the console, while failing when piping to other commands and processes. |
I think it must be something to do with the terminal or OS perhaps. I've created 250 Firebase projects 😅 to try to reproduce. It outputs a JSON response over 3000 lines but it worked fine in my Iterm & VS Code terminal 🤔. FYI;
|
I can confirm that the output of |
I think it is the Firebase CLI response in certain environments that is causing the bug. I found this issue on the and a potential fix here that actually refers to this bug on the FlutterFire CLI:firebase/firebase-tools#5310 I've elevated this issue/PR with the Firebase team so hopefully we can get this resolved upstream. Thank you for your patience! |
Hey folks, the Firebase CLI has just released a version which ought to fix this issue: https://github.com/firebase/firebase-tools/releases/tag/v12.5.4 Could you please run |
Thank you for confirming, @guidezpl! I'll close this issue out. |
Is there an existing issue for this?
CLI Version
0.2.0
Firebase Tools version
11.23.1
Flutter Doctor Output
N/A
Description
flutter configure
throws if the list of projects is long enoughSteps to reproduce
flutterfire configure
with a list of projects fromfirebase projects:list --json
that is ~2000 lines or moreExpected behavior
No crashing, better error
Screenshots
No response
Additional context and comments
No response
The text was updated successfully, but these errors were encountered: