"Uncaught SyntaxError: Unexpected token '{' #11897

Closed
opened 2026-02-21 19:04:37 -05:00 by yindo · 3 comments
Owner

Originally created by @youngyajun on GitHub (Mar 20, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.0.1

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

I deployed Dify using the source code method and published a chat application (a URL link), which I then integrated into an Android app via H5. When using this chat application within the app, I encountered the following issues:

On certain Huawei phone models, the chat application works normally the first time within the app. However, on the second attempt, it fails to load and displays a blank page. If I clear all app data, including cache, the user can use the chat application again within the app, but then it becomes inaccessible again, showing a blank page.
On Xiaomi phone models, the chat application has been tested and works normally every time.
Additionally, Huawei phones can access the published chat application normally through WeChat or a browser.
Below is an image of the error message from the Android app:

Image

How can I solve this problem?

✔️ Expected Behavior

The expected behavior is that Huawei phone models should be able to access the chat application normally, rather than being able to access it only once and then failing again.

Actual Behavior

Some Huawei phone models cannot access the chat application properly, but they can access it on the first attempt after completely clearing the app cache.

Originally created by @youngyajun on GitHub (Mar 20, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.0.1 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce I deployed Dify using the source code method and published a chat application (a URL link), which I then integrated into an Android app via H5. When using this chat application within the app, I encountered the following issues: On certain Huawei phone models, the chat application works normally the first time within the app. However, on the second attempt, it fails to load and displays a blank page. If I clear all app data, including cache, the user can use the chat application again within the app, but then it becomes inaccessible again, showing a blank page. On Xiaomi phone models, the chat application has been tested and works normally every time. Additionally, Huawei phones can access the published chat application normally through WeChat or a browser. Below is an image of the error message from the Android app: ![Image](https://github.com/user-attachments/assets/3d518bb7-89c4-49a7-948b-5fd577fb1aea) How can I solve this problem? ### ✔️ Expected Behavior The expected behavior is that Huawei phone models should be able to access the chat application normally, rather than being able to access it only once and then failing again. ### ❌ Actual Behavior Some Huawei phone models cannot access the chat application properly, but they can access it on the first attempt after completely clearing the app cache.
yindo added the 🐞 bug label 2026-02-21 19:04:37 -05:00
yindo closed this issue 2026-02-21 19:04:37 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 20, 2025):

Hey there, @youngyajun! 👋 I'm here to help you with bug fixes, questions, and becoming a contributor. Let's squash those bugs together!

I found a similar unsolved discussion titled "Application error: a client-side exception has occurred(see the browser console for more information)" which might be related to your issue. You can view it here [1].

For your specific issue, the "Uncaught SyntaxError: Unexpected token '{'" error suggests there might be a problem with the JavaScript code being executed in the WebView on Huawei devices. Here are a few steps you can try to resolve this:

  1. Check JavaScript Compatibility: Ensure that the JavaScript code used in your application is compatible with the WebView version on Huawei devices. Some older WebView versions might not support certain JavaScript syntax or features.

  2. Polyfills and Transpilation: Use tools like Babel to transpile your JavaScript code to a version that is compatible with older browsers or WebViews. This can help avoid syntax errors related to unsupported features.

  3. Debugging: Use remote debugging tools to inspect the WebView on Huawei devices. This can help you identify the exact line of code causing the syntax error.

  4. ChunkLoadError: This error indicates that there might be issues with loading JavaScript chunks. Ensure that all necessary resources are correctly loaded and accessible. Check network requests to see if any files are failing to load.

  5. WebView Settings: Review the WebView settings in your Android app. Ensure that JavaScript is enabled and that any necessary settings for loading external resources are correctly configured.

These steps should help you identify and resolve the issue with the chat application on Huawei devices.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 20, 2025): <!-- Greeting --> Hey there, @youngyajun! 👋 I'm here to help you with bug fixes, questions, and becoming a contributor. Let's squash those bugs together! <!-- Answer --> I found a similar unsolved discussion titled "Application error: a client-side exception has occurred(see the browser console for more information)" which might be related to your issue. You can view it [here](https://github.com/langgenius/dify/discussions/15438) <sup>[[1]](https://github.com/langgenius/dify/discussions/15438)</sup>. For your specific issue, the "Uncaught SyntaxError: Unexpected token '{'" error suggests there might be a problem with the JavaScript code being executed in the WebView on Huawei devices. Here are a few steps you can try to resolve this: 1. **Check JavaScript Compatibility**: Ensure that the JavaScript code used in your application is compatible with the WebView version on Huawei devices. Some older WebView versions might not support certain JavaScript syntax or features. 2. **Polyfills and Transpilation**: Use tools like Babel to transpile your JavaScript code to a version that is compatible with older browsers or WebViews. This can help avoid syntax errors related to unsupported features. 3. **Debugging**: Use remote debugging tools to inspect the WebView on Huawei devices. This can help you identify the exact line of code causing the syntax error. 4. **ChunkLoadError**: This error indicates that there might be issues with loading JavaScript chunks. Ensure that all necessary resources are correctly loaded and accessible. Check network requests to see if any files are failing to load. 5. **WebView Settings**: Review the WebView settings in your Android app. Ensure that JavaScript is enabled and that any necessary settings for loading external resources are correctly configured. These steps should help you identify and resolve the issue with the chat application on Huawei devices. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/54a7025f-5a94-48cd-9f59-7094483bd3f5?feedback_type=other)</sup>
Author
Owner

@youngyajun commented on GitHub (Mar 20, 2025):

I found that someone else encountered the same issue as me. Please refer to: https://github.com/langgenius/dify/discussions/15438.

@youngyajun commented on GitHub (Mar 20, 2025): I found that someone else encountered the same issue as me. Please refer to: https://github.com/langgenius/dify/discussions/15438.
Author
Owner

@crazywoola commented on GitHub (Mar 20, 2025):

We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.

@crazywoola commented on GitHub (Mar 20, 2025): We do not provide technical support for starting from the source. Thank you for your understanding. We assume you have the necessary expertise to set it up independently. If you require technical support, please obtain our business license by contacting us at business@dify.ai.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#11897