I cant to find this problem in other place. Im trying deploy my project and are ocourring a An unexpected error has occurred.
ng serve work fine local but when,
firebase deploy : https://www.youtube.com/watch?v=aICeVhu2mAE
FIREBASE-DEBUG.LOG
Tue Jan 16 2018 09:52:32 GMT-0300 (Hora oficial do Brasil)
[debug] [2018-01-16T12:52:32.852Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'myproject-d9349'...
[info]
[info] i deploying database, hosting
[debug] [2018-01-16T12:52:34.497Z] TypeError: rulesConfig.forEach is not a function
at module.exports (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\database\prepare.js:30:15)
at _chain (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:23:45)
at C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:77:12
at tryCatch (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:525:12)
at invokeCallback (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:538:13)
at publish (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:508:7)
at flush (C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:2415:5)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
[error]
[error] Error: An unexpected error has occurred.
firebase.json
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"/.*",
"/node_modules/"
],
"rewrites": [
{
"source": "",
"destination": "/index.html"
}
]
},
"database": {
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
}
package.json
{
"name": "myproject",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"": "^1.0.0-beta.2",
"@angular/animations": "^4.4.6",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/flex-layout": "^2.0.0-beta.9",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"": "^1.3.1",
"": "^1.2.2",
"": "^1.0.4",
"": "^1.4.0",
"": "^2.43.2",
"angular-chart.js": "^1.1.1",
"angular-hammer": "^2.2.0",
"angular2-text-mask": "^8.0.4",
"angularfire2": "^5.0.0-rc.3",
"bootstrap": "^4.0.0-beta.2",
"chart.js": "^2.7.1",
"core-js": "^2.4.1",
"firebase": "^4.6.0",
"hammerjs": "^2.0.8",
"jquery": "^3.2.1",
"materialize-css": "^0.100.2",
"ng2-charts": "^1.6.0",
"ng2-dropdown": "0.0.21",
"ng2-input-mask": "0.0.7",
"ngx-bootstrap": "^1.9.3",
"popper.js": "^1.12.6",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"": "~2.5.53",
"": "~2.0.2",
"": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}
Thanks if somebody can help me and sry if dumb question.
Try moving your rules into a separate file and changing database.rules to
be a string pointing to the filename instead.
On Tue, Jan 16, 2018, 5:52 PM Diego Vieira notifications@github.com wrote:
I cant to find this problem in other place. Im trying deploy my project
and are ocourring a An unexpected error has occurred.ng serve work fine local but when,
firebase deploy : https://www.youtube.com/watch?v=aICeVhu2mAE
FIREBASE-DEBUG.LOG
Tue Jan 16 2018 09:52:32 GMT-0300 (Hora oficial do Brasil)
[debug] [2018-01-16T12:52:32.852Z] <<< HTTP RESPONSE 200
[info]
[info] === Deploying to 'myproject-d9349'...
[info]
[info] i deploying database, hosting
[debug] [2018-01-16T12:52:34.497Z] TypeError: rulesConfig.forEach is not a
function
at module.exports
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\database\prepare.js:30:15)
at _chain
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:23:45)
at
C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:77:12
at tryCatch
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:525:12)
at invokeCallback
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:538:13)
at publish
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:508:7)
at flush
(C:\Users\diego\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\rsvp\dist\rsvp.js:2415:5)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
[error]
[error] Error: An unexpected error has occurred.firebase.json
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"/.*",
"/node_modules/"
],
"rewrites": [
{
"source": "",
"destination": "/index.html"
}
]
},
"database": {
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
}package.json
{
"name": "myproject",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"": "^1.0.0-beta.2",
"": "^4.4.6",
"": "^4.2.4",
"": "^4.2.4",
"": "^4.2.4",
"": "^2.0.0-beta.9",
"": "^4.2.4",
"": "^4.2.4",
"": "^4.2.4",
"": "^4.2.4",
"": "^4.2.4",
"": "^1.3.1",
"": "^1.2.2",
"": "^1.0.4",
"": "^1.4.0",
"": "^2.43.2",
"angular-chart.js": "^1.1.1",
"angular-hammer": "^2.2.0",
"angular2-text-mask": "^8.0.4",
"angularfire2": "^5.0.0-rc.3",
"bootstrap": "^4.0.0-beta.2",
"chart.js": "^2.7.1",
"core-js": "^2.4.1",
"firebase": "^4.6.0",
"hammerjs": "^2.0.8",
"jquery": "^3.2.1",
"materialize-css": "^0.100.2",
"ng2-charts": "^1.6.0",
"ng2-dropdown": "0.0.21",
"ng2-input-mask": "0.0.7",
"ngx-bootstrap": "^1.9.3",
"popper.js": "^1.12.6",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"": "1.4.9",
"": "^4.2.4",
"": "^4.2.4",
"": "~2.5.53",
"": "~2.0.2",
"": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}Thanks if somebody can help me and sry if dumb question.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/599, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_iTW9tkiqDsllmZxcz535RohJJlaks5tLVJfgaJpZM4RgsUp
.
@mbleigh that did not help me. Any other workarounds?
@kobvel. I create other instance of angular/angularfire and move my components for this new and work. Was the best and fast way that I find. =(
@kobvel The solution @mbleigh suggested worked for me. Using firebase-tools 3.17.5:
File /firebase.json:
{
"database": {
"rules": "firebase.database.json"
},
"hosting": {
"public": "dist",
"rewrites": [{
"source": "**",
"destination": "/index.html"
}]
}
}
File /firebase.database.json:
{
"rules": {
".read": "true",
".write": "true"
}
}
I updated my firebase-functions and firebase-admin as follows and it fixed it:
"firebase-admin": "^5.12.0",
"firebase-functions": "^1.0.1",
@IanWambai wow that solution actually worked. Thank you! Changed a ~ to a ^. So weird.
@IanWambai's solution worked for me also. Odd that the firebase init scaffold starts you out with something that won't deploy?
I had to downgrade to firebase-tools 3.18.4 for it to go away. I tried using the latest of every firebase module/library and that didn't fix it (as well as a whole lot of versions in between).
Locally, I'm using:
"firebase-admin": "^5.12.1",
"firebase-functions": "1.0.3"
and globally:
firebase-tools 3.18.4
This seems to be a good combination. My guess is that there is some sort of syntax that I have in my firebase setup code that was okay in the older firebase-tools library but the newer version doesn't like but there's no way to tell what it is with such a vague error message or what I need to change it to.
firebase.json
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"headers": [
{"source": "/service-worker.js", "headers": [{"key": "Cache-Control", "value": "no-cache"}]}
],
"rewrites": [ {
"source": "**",
"destination": "/index.html"
}]
},
"database": {
"rules": "firebase.rtdb.rules.json"
}
}
.firebaserc
{
"projects": {
"default": "example-test"
}
}
Solution:
npm uninstall firebase
npm uninstall firebase-tools
After:
npm install -g firebase-tools@latest
In firebase.json:
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"database-rules.json",
"storage.rules",
"functions",
"/.",
"/node_modules/"
],
"headers": [
{
"source": "/.@(js|html)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=0"
}
]
}
]
}
}
@cbracamonte thanks!
npm uninstall firebase-tools then npm install -g firebase-tools@latest worked for me
I'm getting the following error:
[info] i deploying hosting
[info] i hosting: preparing public directory for upload...
[warn] âš Warning: Public directory does not contain index.html
[debug] [2018-12-23T12:46:12.821Z] >>> HTTP REQUEST PUT https://deploy.firebase.com/v1/hosting/sentry-spa/uploads/-LUQ5T4sccw0UCXzFY18?fileCount=3787&message=
Sun Dec 23 2018 06:46:12 GMT-0600 (Central Standard Time)
[debug] [2018-12-23T12:49:46.732Z] <<< HTTP RESPONSE 410
[debug] [2018-12-23T12:49:46.732Z] <<< HTTP RESPONSE BODY undefined
[debug] [2018-12-23T12:49:46.734Z] TypeError: Cannot read property 'error' of undefined
at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/responseToError.js:10:13)
at Request._callback (/usr/local/lib/node_modules/firebase-tools/lib/api.js:45:25)
at Request.self.callback (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:186:22)
at Request.emit (events.js:182:13)
at Request.EventEmitter.emit (domain.js:441:20)
at Request.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1163:10)
at Request.emit (events.js:182:13)
at Request.EventEmitter.emit (domain.js:441:20)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/request/request.js:1085:12)
at Object.onceWrapper (events.js:273:13)
[error]
[error] Error: An unexpected error has occurred.
Already tried the following:
npm install -g firebase-tools@latest
It did not help me.
Please advise.
@cbracamonte thanks!
npm uninstall firebase-toolsthennpm install -g firebase-tools@latestworked for me
I tried this but it did not help me. Please refer the above detailed comment with error in debug logs. It will be much appreciated if you can provide some guidance on it.
@goelmk please open a new issue with the details of the version of firebase-tools you have installed and the relevant information. Thanks.
Most helpful comment
@kobvel The solution @mbleigh suggested worked for me. Using
firebase-tools 3.17.5:File
/firebase.json:File
/firebase.database.json: