Skip to content

Only use the last output buffer from the deploy execute command#19

Merged
jhuleatt merged 1 commit intoFirebaseExtended:mainfrom
stewart42:main
Sep 25, 2020
Merged

Only use the last output buffer from the deploy execute command#19
jhuleatt merged 1 commit intoFirebaseExtended:mainfrom
stewart42:main

Conversation

@stewart42
Copy link
Copy Markdown
Contributor

Hi there, I have created this PR to highlight a fix I needed to implement in order to get the action to complete successfully with our current build and deploy action:

The error below (raw logs):

020-09-14T15:15:52.5567756Z ##[group]Run FirebaseExtended/action-hosting-deploy@v0
2020-09-14T15:15:52.5568356Z with:
2020-09-14T15:15:52.5569194Z   repoToken: ***
2020-09-14T15:15:52.5593505Z   firebaseServiceAccount: ***

2020-09-14T15:15:52.5594134Z   projectId: <removed>
2020-09-14T15:15:52.5594608Z   expires: 7d
2020-09-14T15:15:52.5595023Z   entryPoint: .
2020-09-14T15:15:52.5595402Z env:
2020-09-14T15:15:52.5595879Z   FIREBASE_CLI_PREVIEWS: hostingchannels
2020-09-14T15:15:52.5596389Z ##[endgroup]
2020-09-14T15:15:52.9027131Z ##[group]Verifying firebase.json exists
2020-09-14T15:15:52.9032334Z firebase.json file found. Continuing deploy.
2020-09-14T15:15:52.9033813Z ##[endgroup]
2020-09-14T15:15:52.9034864Z ##[group]Setting up CLI credentials
2020-09-14T15:15:52.9056253Z Created a temporary file with Application Default Credentials.
2020-09-14T15:15:52.9057065Z ##[endgroup]
2020-09-14T15:15:52.9059141Z ChannelId "pr1117-devops/preview-chann" contains unsupported characters. Using "pr1117-devops_preview-chann" instead.
2020-09-14T15:15:52.9061241Z ##[group]Deploying to Firebase preview channel pr1117-devops_preview-chann
2020-09-14T15:15:52.9125011Z [command]/opt/hostedtoolcache/node/12.18.3/x64/bin/npx firebase-tools hosting:channel:deploy pr1117-devops_preview-chann --project <removed> --json
2020-09-14T15:16:21.8119554Z �[2K�[9999D***
2020-09-14T15:16:21.8120456Z   "status": "success",
2020-09-14T15:16:21.8121114Z   "result": ***
2020-09-14T15:16:21.8121705Z     "<removed>": ***
2020-09-14T15:16:21.8123270Z       "site": "<removed>",
2020-09-14T15:16:21.8123801Z       "target": "over",
2020-09-14T15:16:21.8125374Z       "url": "<removed>",
2020-09-14T15:16:21.8127228Z       "expireTime": "2020-09-21T15:16:15.792976521Z"
2020-09-14T15:16:21.8127662Z     ***,
2020-09-14T15:16:21.8128008Z     "<removed>": ***
2020-09-14T15:16:21.8128662Z       "site": "<removed>",
2020-09-14T15:16:21.8129233Z       "target": "godaddy",
2020-09-14T15:16:21.8131101Z       "url": "https://<removed>.web.app",
2020-09-14T15:16:21.8132773Z       "expireTime": "2020-09-21T15:16:15.762875096Z"
2020-09-14T15:16:21.8133180Z     ***
2020-09-14T15:16:21.8133480Z   ***
2020-09-14T15:16:21.8133794Z ***
2020-09-14T15:16:22.9545360Z 
2020-09-14T15:16:22.9549418Z ##[error]Unexpected token � in JSON at position 0

As you can see there are additional characters \x1B[2K\x1B[9999D (base64 value G1sySxtbOTk5OUQ=) at the beginning of the output, this leads to the failure of the JSON.parse call. While debugging I determined that it was always the first push into the buffer array variable on line 70 that had these odd characters. Where these characters come from I am not sure. I didn't want to alter the code too much, and rather just changed the return value of the function to on return the last buffer in the array which appears to consistently have the JSON output.

Thanks for making this action! Other than this odd issue it has been working great!

@googlebot googlebot added the cla: yes Contributor has signed CLA label Sep 15, 2020
@jhuleatt
Copy link
Copy Markdown
Collaborator

Thank you for this fix @stewart42!

@jhuleatt jhuleatt merged commit c5b54d0 into FirebaseExtended:main Sep 25, 2020
@FirebaseExtended FirebaseExtended locked and limited conversation to collaborators Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes Contributor has signed CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants