After configuring the routing and static resource prefixes, some resource references on the packaged page have the prefix, but some do not.
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.1.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Next.js configuration file
The resource references of the page after packaging
✔️ Expected Behavior
The resource introductions on the page after packaging should all be prefixed according to the configuration.
❌ Actual Behavior
No response
In a Next.js application, some resources might not receive the prefix due to specific conditions related to environment variables and document attributes. Here are some potential reasons why this might happen:
-
Environment Variables Not Set: Ensure that the environment variables
NEXT_PUBLIC_API_PREFIXandNEXT_PUBLIC_PUBLIC_API_PREFIXare correctly set. If these are not set, the application will attempt to retrieve the prefixes from the document's body attributes. If these attributes (data-api-prefixanddata-pubic-api-prefix) are also not present, default values are used instead. -
Document Attributes Not Present: If the document's body does not have the attributes
data-api-prefixanddata-pubic-api-prefix, and the environment variables are not set, the application defaults to using hardcoded URLs likehttp://localhost:5001/console/apiandhttp://localhost:5001/api. -
Marketplace Prefixes: Similarly, if
NEXT_PUBLIC_MARKETPLACE_API_PREFIXandNEXT_PUBLIC_MARKETPLACE_URL_PREFIXare not set, and the document's body does not have the attributesdata-marketplace-api-prefixanddata-marketplace-url-prefix, the marketplace prefixes will be empty strings [1].
To resolve the issue, verify that all necessary environment variables are set correctly in your .env.local file and that the document attributes are present if needed. Additionally, ensure that the basePath and assetPrefix settings in your Next.js configuration file are correctly configured to match your deployment environment.
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