Home > database >  How to host flutter application in Firebase?
How to host flutter application in Firebase?

Time:01-04

What is the freshest instruction on how to host a flutter web app? I am following https://developer.school/tutorials/hosting-a-flutter-web-project-on-firebase-hosting on Windows, and the step firebase init here fails for me.

Here is the content of firebase-debug.log:

You're about to initialize a Firebase project in this directory:

  C:\Coding Repository\230102 flutter hello world\flutter_hello_world

Before we get started, keep in mind:

  * You are currently outside your home directory

[info] 
=== Project Setup
[info] 
[info] First, let's associate this project directory with a Firebase project.
[info] You can create multiple project aliases by running firebase use --add, 
[info] but for now we'll just set up a default project.
[info] 
[info] i  If you want to create a project in a Google Cloud organization or folder, please use "firebase projects:create" instead, and return to this command when you've created the project. 
[debug] [2023-01-03T04:11:48.673Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects [none]
[debug] [2023-01-03T04:11:48.674Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"projectId":"flutter_hello_world_deployment_by_mish","name":"flutter_hello_world"}
[debug] [2023-01-03T04:11:48.832Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects 400
[debug] [2023-01-03T04:11:48.832Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"project_id","description":"project_id must be at most 30 characters long"},{"field":"project_id","description":"project_id contains invalid characters"},{"field":"display_name","description":"project display name contains invalid characters"}]},{"@type":"type.googleapis.com/google.rpc.Help","links":[{"url":"https://cloud.google.com/resource-manager/reference/rest/v1/projects"}]}]}}
[debug] [2023-01-03T04:11:48.881Z] FirebaseError: HTTP Error: 400, Request contains an invalid argument.
    at responseToError (C:\Users\mishc\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:49:12)
    at RetryOperation._fn (C:\Users\mishc\AppData\Roaming\npm\node_modules\firebase-tools\lib\apiv2.js:288:77)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[error] 
[error] Error: Failed to create project. See firebase-debug.log for more info.

CodePudding user response:

The error message says:

project_id must be at most 30 characters long

So it sounds like you entered a project ID that was longer than that.

  • Related