Resolve X-Content-Type Mismatch for SCA 2019.1
To implement this patch, create a custom module to override the customFieldsMetadata.ssp
SuiteScript file, which is part of the CustomFields module.
If you are unfamiliar with implementing patches for SuiteCommerce Advanced (SCA), refer to:
Step 1: Create the Override File for customFieldsMetadata.ssp
-
Following the instructions in the Patch Using Override Mode procedure, create a new directory and file:
/Modules/extensions/CustomFieldsExtension@1.0.0/SuiteScript/customFieldsMetadata.ssp
-
In the new
customFieldsMetadata.ssp
file, find and replace the following line of code with the provided code samples.Find the following code:
response.write('SC.ENVIRONMENT.customFieldsMetadata=' + JSON.stringify(metadata));
Replace it with the following code:
response.setContentType('JAVASCRIPT'); response.write('SC.ENVIRONMENT.customFieldsMetadata=' + JSON.stringify(metadata));
Step 2: Prepare the Developer Tools for Your Patch
When preparing the Developer Tools for your patch as described in the Patch Using Override Mode procedure, perform the following actions:
-
Paste the following sample code into the new
ns.package.json
file that you created in the Modules directory:/Modules/extensions/CustomFieldsExtension@1.0.0/ns.package.json
{ "gulp": { "ssp-files": [ "SuiteScript/*.ssp" ] }, "overrides": { "suitecommerce/CustomFields@X.Y.Z/SuiteScript/customFieldsMetadata.ssp" : "SuiteScript/customFieldsMetadata.ssp" } }
Important:Replace the string, X.Y.Z, with the version of the module in your implementation of SCA.
-
Open the
distro.json
file in the root SCA development directory and add your custom module to themodules
object as described in the Patch Using Override Mode procedure. The following sample shows the value to add to the list of existing values that follow the “modules
” key."modules": { "extensions/CustomFieldsExtension": "1.0.0", ... }
Step 3: Test and Deploy Your Patch
Follow the instructions provided in the Patch Using Override Mode procedure to test and deploy your patch.
Step 4: Check Custom SSPs
In addition to the customFieldsMetadata.ssp
file, your custom SSPs may also be affected. Follow these instructions to confirm they are correctly set up.
-
Review your custom SSPs to confirm that the Content-Type set in the response header matches the content returned.
-
If no Content-Type is set, you will need to define the correct one for your custom SSP.
-
Make sure the services you created to handle http requests follow best practices. See Create and Use SSP Applications
If your services are not following best practice, you should extend ServiceController. See Create a Service to Handle HTTP Requests.
Related Topics
- Resolve X-Content-Type Mismatch for Commerce Websites
- Resolve X-Content-Type Mismatch for SuiteCommerce
- Resolve X-Content-Type Mismatch for SCA 2019.2 to 2023.2
- Resolve X-Content-Type Mismatch for SCA 2018.2
- Resolve X-Content-Type Mismatch for SCA Elbrus to Aconcagua, SB Extensions Premium Elbrus and Kilimanjaro