AWS Amplify unable to pull backend after remove unused services got error not enough bytes in the stream. expected - aws-amplify

After removing unused services, I was unable to push the code (amplify push) and got this error.
the command that I run
amplify remove notifications
amplify remove analytics
CLI error (amplify push):
✖ There was an error pulling the backend environment dev.
🛑 not enough bytes in the stream. expected 15644. got only 11274
Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
Session Identifier: 7afb1bd4-92b7-47dc-a33c-da119f94dfc9
✅ Report saved: /var/folders/6r/4np_tfpj3dbc69f1mc7l2gph0000gn/T/jammaroundapp/report-1674513678504.zip
✔ Done
Project Identifier: 1c09b09cbdd7fadb87731c2182daedce
Error.json
{
"name":"BackendPullFault",
"classification":"FAULT",
"options":{
"message":"not enough bytes in the stream. expected 15644. got only 11274"
},
"downstreamException":{
},
"link":"https://docs.amplify.aws/cli/project/troubleshooting/"
}
I try to pull the AWS Amplify in a new project and got this error "Failed to pull the backend" and also try to update anything on the AWS Amplify dashboard and press on Save and Deploy button but got this error
Deployment failed
not enough bytes in the stream. expected 15644. got only 11274 at AssertByteCountStream._flush
amplify cli version 10.6.2

Related

"invalid source token" while deploying a function to fireabse

i got wired issued with firebase deployment using:
firebase deploy -P dev
the error is
✔ functions[testFunction(us-central1)] Successful update operation.
Invalid source token
looks like its happen to new functions that created
when i tried to deploy specific function using:
firebase -deploy -P dev --only functions:name
its working
when i run and deploy all functions and all my apps i am getting the above error with no information
also the logs from google cloud function is:
status: {
code: 9
message: "Invalid source token"
}
firebase tools version 11.0.0
node: 14.19.3
I would suggest upgrading to atleast node 16 as there's an open issue regarding the "Invalid Source Token" on your current firebase-tools version. There's already a pull request regarding that issue and it will be fixed on the upcoming updates. Here's the github issue for reference.

Error: An unexpected error has occurred when running firebase login command

firebase login --debug
i Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.
? Allow Firebase to collect CLI usage and error reporting information? Yes
i To change your data collection preference at any time, run firebase logout and log in again.
Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com&scope=email%20openid%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloudplatformprojects.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Ffirebase%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform&response_type=code&state=151882733&redirect_uri=http%3A%2F%2Flocalhost%3A9005
Waiting for authentication...
[2020-04-21T13:30:57.183Z] Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Error: An unexpected error has occurred.
Having trouble? Try again or contact support with contents of firebase-debug.log
This problem's solution may depend on the type of OS one is using if you are using window first run cmd as an administrator then type firebase login this should solve this problem and if your OS is Linux you may need to do sudo firebase login can be solved by

Firebase Functions Error while deploying to emulator

I'm trying to start new Firebase Functions project using latest versions of packages.
I've followed this tutorial https://youtu.be/DYfP-UIKxH0:
Firebase login
Firebase init
Created functions project the same way as tutorial says
Uncommented index.ts content
After that I get this error:
Starting #google-cloud/functions-emulator
[2018-04-04T19:05:12.124Z] Parsing function triggers
[2018-04-04T19:05:12.404Z] Error while deploying to emulator: TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at Promise (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:34:42)
at getService.then (/usr/local/lib/node_modules/firebase-tools/node_modules/#google-cloud/functions-emulator/src/client/rest-client.js:33:16)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
⚠ functions: Failed to emulate helloWorld
I have latest functions emulator *1.0.0-beta4.
All other libs are in latest versions...
I'm at point where I have no idea how to debug this better and how to resolve this
This error occurs if an existing process listens on port 5000. Double check if there's a process running, e.g. on Mac OS Sierra
sudo lsof -n -iTCP:5000 | grep LISTEN
Stop this process or run firebase on another port, e.g.
firebase -p 7777 serve --only functions
No need to reinstall packages. Error message is not helpful and we spent some time to find the root cause.
It turned out that it was due other app that was listening on port 5001!
Firebase serve stops with some weird message.
Just check as answer below if ports aren't busy

Firebase Cloud Functions Shell not executing write operations on realtime database

Since a few days I am not able to test cloud functions locally anymore, as all write functions are not executed and nothing is returned, consequently the function hangs and eventually stops with a timeout.
Example function:
import { database as dbEvent } from "firebase-functions";
export default dbEvent.ref("/tariffs/removeHistory").onCreate((event: any) => {
console.log("START");
const bikesHistoryRef = event.data.adminRef.parent.parent.child("bikesHistory");
return bikesHistoryRef.set(null).then((res) => console.log("Delete done", res));
});
Result:
firebase > removeBikeHistory("test")
'Successfully invoked function.'
firebase > info: User function triggered, starting execution
info: START
firebase >
firebase > info: Execution took 61023 ms, finished with status: 'timeout'
info: Execution took 49694 ms, finished with status: 'crash'
Any suggestion what is wrong? This happens with all my cloud functions, and when I deploy them it works.
I have tried with:
firebase-admin#5.5.1
firebase-functions#0.7.3
firebase-tools#3.15.4 (-g)
and
firebase-admin#5.6.0
firebase-functions#0.7.5
firebase-tools#3.16.0 (-g)
EDIT:
After enabling logging I get the following errors:
info: 0: onDisconnectEvents
info: p:0: Making a connection attempt
info: p:0: Failed to get token: Error: Credential implementation provided to initializeApp() via the "credential" property failed to fetch a valid Google OAuth2 access token with the following error: "Error fetching access token: invalid_grant (Bad Request)". There are two likely causes: (1) your server time is not properly synced or (2) your certificate key file has been revoked. To solve (1), re-sync the time on your server. To solve (2), make sure the key ID for your key file is still present at https://console.firebase.google.com/iam-admin/serviceaccounts/project. If not, generate a new key file at https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk.
p:0: data client disconnected
info: p:0: Trying to reconnect in 1283.8299240003184ms
0: onDisconnectEvents
I have actually seen this error when I installed an older firebase-function/admin version, but thought it got fixed by installing the newer version. How can I fix it?
I found the solution in this bug report:
https://github.com/firebase/firebase-functions/issues/135
I have deleted the following file, now my cloud functions work locally again:
rm ~/.config/gcloud/application_default_credentials.json

Error: Server Error. connect ETIMEDOUT 104.197.85.31:443

i am using firebase cli and i try the following
$ firebase init
the cli continue with the message :
You're about to initialize a Firebase project in this directory:
c:\Dev\Test
are you ready to proceed ?
i type y
and choose Hosting:Configure and deploy Firebase Hosting sites
after few second i get the error
Error: Server Error. connect ETIMEDOUT 104.197.85.31:443
what can be the problem ?
my Enviroment specification:
CLI Version: 3.9.1
Platform: win32
Node Version: v7.10.0
Time:Thu Jun 08 2017 18:03:14 GMT+0430 (Iran Daylight Time)
i am useing PSIPHONE also as a proxy but i have also tried without PSIPHONE .
in both cases i get connection timeout
i have pinged 104.197.85.31 the connection is ok .
any suggestion to solve the issue ?
is it because i am in IRAN ?
Just close your terminal and re-run these commands.
firebase login
and now try again
firebase deploy --only hosting
It works for me!!!
I don't know why this is the first result on google but the second result had the answer:
https://stackoverflow.com/a/63832234/3393964
npm i -g firebase-tools
Updating firebase tools worked for me. then, try again firebase deploy.
if it still didn't work try clearing the firebase cache which is the .firebase file
It's on the Firebase's end. You can check status here.
In my case, my work PC started blocking Firebase deploys (Even on my mobile network).
Deploying from my home PC worked just fine.

Resources