github-action
github-action copied to clipboard
Upload source: Error from server: <Code: <empty_code>, Message: Unexpected character ('<' (code 60))
Hey Team, I am adding the Github Actions to upload resources and get this error,
Describe the bug
UPLOAD SOURCES ❌ Fetching project info ❌ Failed to collect project info. Please contact our support team for help ❌ Error from server: <Code: <empty_code>, Message: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"
To Reproduce
Steps to reproduce the behavior:
crowdin.yml
file content
project_identifier: androididentifer
api_key: .......
preserve_hierarchy: true
base_path: './'
# Needed for Crowdin github actions
project_id_env: CROWDIN_PROJECT_ID
api_token_env: CROWDIN_PERSONAL_TOKEN
files:
- source: '/**/src/main/res/values/strings.xml'
translation: '/**/src/main/res/values-%android_code%/%original_file_name%'
languages_mapping:
android_code:
....
Information about workflow (OS, steps, etc.)
name: Upload Translation Source
on:
pull_request:
types: [ labeled ]
jobs:
synchronize-with-crowdin:
runs-on: [ self-hosted ]
steps:
- name: Verify Required Labels
run: |
if ${{ github.event.label.name == 'Needs translations' }}; then
echo "Has Required Labels"
else
echo "Failed. Missing required labels. Skipping status check on commit."
exit 1
fi
- name: Clean Branch Name
run: |
branch="${BRANCH_NAME////_}"
echo "branch_name=$branch" >> $GITHUB_ENV
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
- name: Checkout
uses: actions/checkout@v2
- name: upload translation source
uses: crowdin/[email protected]
with:
upload_sources: true
upload_sources_args: "-b ${{ env.branch_name }}"
config: ./crowdin.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
Hi @lixw1021!
Please check the name of branch that GH Action is trying to create in Crowdin. Branch name can't contain \ / : * ? " < > |
symbols.
Hi @lixw1021!
Please check the name of branch that GH Action is trying to create in Crowdin. Branch name can't contain
\ / : * ? " < > |
symbols.
Hey @andrii-bodnar ,
the branch name is f_android-79_migrate_upload_translations_to_github_action
which looks good,
I think the error happens when it check android string file, the error shows:
❌ Error from server: <Code: <empty_code>, Message: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"<?xml version="1.0" encoding="UTF-8"?>
but android String file always start with <?xml version="1.0" encoding="UTF-8"?>
like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="see_what_you">See what you</string>
</resources>
@lixw1021 could you please share your Crowdin project ID?
@lixw1021 could you please share your Crowdin project ID?
it's 168308, please let me know if you need more information. Thanks
Hey @andrii-bodnar, any update for this?
Hi @lixw1021!
Thanks for sharing your project ID. Could you please add the debug_mode
parameter to the Crowdin GH Action config and try again? It should provide more data in the action logs. Then please share this log with us.
- name: upload translation source
uses: crowdin/[email protected]
with:
debug_mode: true
...
...
Hi @andrii-bodnar , Please find attached log, where I have hidden the company name and project name, let me know if you need more information. Thansk
---------------------------
STARTING CROWDIN ACTION
UPLOAD SOURCES
❌ Fetching project info
java.lang.RuntimeException: Failed to collect project info. Please contact our support team for help
at com.crowdin.cli.utils.console.ConsoleSpinner.execute(ConsoleSpinner.java:29)
at com.crowdin.cli.commands.actions.UploadSourcesAction.act(UploadSourcesAction.java:76)
at com.crowdin.cli.commands.actions.UploadSourcesAction.act(UploadSourcesAction.java:56)
at com.crowdin.cli.commands.picocli.GenericActCommand.run(GenericActCommand.java:37)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:[145](https://github.com/companyName/projectName/runs/5204901914?check_suite_focus=true#step:6:145))
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at com.crowdin.cli.commands.picocli.PicocliRunner.execute(PicocliRunner.java:37)
at com.crowdin.cli.Cli.main(Cli.java:16)
Caused by: java.lang.RuntimeException: Error from server: <Code: <empty_code>, Message: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"<?xml version="1.0" encoding="UTF-8"?>
<error>
<code>0</code>
<message>Unknown internal error</message>
</error>
"; line: 1, column: 2]>
at com.crowdin.cli.client.CrowdinClientCore.executeRequest(CrowdinClientCore.java:125)
at com.crowdin.cli.client.CrowdinClientCore.executeRequest(CrowdinClientCore.java:100)
at com.crowdin.cli.client.CrowdinClientCore.executeRequestFullList(CrowdinClientCore.java:63)
at com.crowdin.cli.client.CrowdinProjectClient.populateProjectWithStructure(CrowdinProjectClient.java:67)
at com.crowdin.cli.client.CrowdinProjectClient.downloadFullProject(CrowdinProjectClient.java:47)
at com.crowdin.cli.utils.console.ConsoleSpinner.execute(ConsoleSpinner.java:24)
... 12 more
Hi @lixw1021, thanks a lot for the details.
Please try to use the following Crowdin GH Action config:
- name: upload translation source
uses: crowdin/[email protected]
with:
upload_sources: true
crowdin_branch_name: ${{ env.BRANCH_NAME }}
config: ./crowdin.yaml
Hey @andrii-bodnar, unfortunately, we still have the same issue.
STARTING CROWDIN ACTION
UPLOAD SOURCES
❌ Fetching project info
❌ Failed to collect project info. Please contact our support team for help
❌ Error from server: <Code: <empty_code>, Message: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (String)"<?xml version="1.0" encoding="UTF-8"?>
<error>
<code>0</code>
<message>Unknown internal error</message>
</error>
"; line: 1, column: 2]>
hi @andrii-bodnar , do we have any update here? Thanks
Hi @lixw1021, we have investigated this issue and found that it's related to a large number of branches and files in your project.
Currently, the fix is in progress. I will try to speed up this and will return with the answer.
Sorry for the delay.
Hi @andrii-bodnar, is there any update on this? Xianwei is no longer with us at Turo but I'll most likely be taking this over.
HI @safa007,
The fix is already here - https://github.com/crowdin/crowdin-cli/pull/447
But our QA team has found some major bugs in this PR, that are still in progress the fix
We will do our best to somehow speed up this 😬
The issue should be resolved now since we've made some fixes and improvements on the API side