Wednesday, 9 January 2019

Change JSON file path and loading from external to internal

2 JSON files of this open source Amazon Alexa skill are external. How to load them internally?

These are the files:

  1. https://s3-us-west-2.amazonaws.com/ddg-skill/apl/styles.json
  2. https://s3-us-west-2.amazonaws.com/ddg-skill/apl/layouts.json

I tried changing module.exports cdn-path.js to '../' and uploaded both JSON files to lambda in a folder called apl. It didn't load the files but I can't find an error code in the console.

cdn-path.js:

'use strict';

module.exports = 'https://s3-us-west-2.amazonaws.com/ddg-skill/';

This is how the external files get loaded in launch.js: source: ${cdnPath}apl/layouts.json

const cdnPath = require('../helpers/cdn-path');
[...]
    document: {
      type: 'APL',
      version: '1.0',
      theme: 'dark',
      import: [
        {
          name: 'alexa-styles',
          version: '1.0.0-beta'
        },
        {
          name: 'alexa-layouts',
          version: '1.0.0-beta'
        },
        {
          name: 'layouts',
          version: '1.0.0',
          source: `${cdnPath}apl/layouts.json`
        },
        {
          name: 'styles',
          version: '1.0.0',
          source: `${cdnPath}apl/styles.json`
        }
      ]
[...]



from Change JSON file path and loading from external to internal

No comments:

Post a Comment