ODA: Upload to Embedded Component Service Results in Failed to fetch custom component metadata, error response: 504

Today, I hit a really $&#% issue regarding Oracle Digital Assistant (ODA) Chatbot. This has to do with custom component feature. I find this error message misleading and leads to hours of troubleshooting efforts. So, it is better to share here for our further reference.

Oracle Solution

The typical cause for this error is that your component folders contain non-component files. The directories that you name in the components array in the main JavaScript file should point to directories that contain only component files. This includes files in any subdirectories.

Say, for example, that the main JavaScript file sets the components array like the following code example. This statement tells the component service upload process to look in the components directory structure for the custom component definitions. The server will look at every file in the directory structure and try to process each one as a custom component. If there are files in that directory structure that aren’t custom components, the upload process fails because it can’t parse the file as a custom component.

If you get this error, create a separate folder, such as helpers, in the same folder that main.js is in. Then move the non-component files into it, and modify your code accordingly.

Source from Oracle
The Actual Error

The root cause I got from this error is JavaScript syntax error. While loading the custom component, the JavaScript with error is not identified as a component file. As such, it throws this error message in ODA.

Common Syntax Error

Reference to other JavaScript module must be within invoke function.

invoke: (context, done) => {

const fetch=require("node-fetch")
}

Be careful of syntax like semicolon after keepTurn. This will cause the same error message while loading of custom component.

context.transition('success')
context.keepTurn(true);

Hope these ODA tips helps and ease hours of frustration. Great thanks to Oracle Kevin for these!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s