jovotech/jovo-framework

Cannot convert undefined or null to object while building project files for Alexa

acerbisgianluca opened this issue · 1 comments

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Expected Behavior

Here is my project config:

const project = new ProjectConfig({
    defaultStage: 'dev',
    plugins: [
        new AlexaCli({
            askProfile: 'mm',
            locales: {
                en: ['en-US'],
            },
            files: {
                'skill-package/skill.json': {
                    manifest: {
                        events: {
                            subscriptions: [
                                {
                                    eventName: 'SKILL_ACCOUNT_LINKED',
                                },
                            ],
                        },
                    },
                },
            },
        })
    ],
    stages: {
        dev: {
            endpoint: DEV_LAMBDA_ARN,
            plugins: [
                new AlexaCli({
                    skillId: DEV_SKILL_ID,
                    files: {
                        'skill-package/skill.json': {
                            manifest: {
                                events: {
                                    endpoint: {
                                        uri: DEV_LAMBDA_ARN,
                                    },
                                },
                            },
                        },
                    },
                }),
            ],
        },
        prod: {
            endpoint: PROD_LAMBDA_ARN,
            plugins: [
                new AlexaCli({
                    skillId: PROD_SKILL_ID,
                    files: {
                        'skill-package/skill.json': {
                            manifest: {
                                events: {
                                    endpoint: {
                                        uri: PROD_LAMBDA_ARN,
                                    },
                                },
                            },
                        },
                    },
                }),
            ],
        },
    },
});

Running jovo build:platform alexa should produce a valid skill package.

Current Behavior

Currently jovo build:platform alexa fails with the error below.
I see that the build hook for Alexa runs 4 tasks. After adding debug logs, I found out that the error is thrown inside


More precisely the error comes from the call to
checkLocales(projectFiles: FileObject): void {

The error is thrown by the first of these 2 for loops because privacyAndCompliances is undefined.

I think that privacyAndCompliances and publishingInfos should be set by default to an empty object if they are undefined, here.

Does it make sense?

Error Log

Message:
›  Cannot convert undefined or null to object
›                                                                                 
› Module:
›  JovoCliCore
›                                                                                 
›
› Stack:
›  Error: Cannot convert undefined or null to object
›      at Task.run (/home/gianluca/Vocalime/voice-apps/motormouth-voice/node_modules/@jovotech/cli-core/src/Task.ts:111:17)
›      at Task.run (/home/gianluca/Vocalime/voice-apps/motormouth-voice/node_modules/@jovotech/cli-core/src/Task.ts:66:22)
›      at AlexaHook.build (/home/gianluca/Vocalime/voice-apps/motormouth-voice/node_modules/@jovotech/platform-alexa/src/cli/hooks/BuildHook.ts:202:5)
›      at EventEmitter.run (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@jovotech/cli-core/src/EventEmitter.ts:53:7)
›      at BuildPlatform.run (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@jovotech/cli-command-build/src/commands/build.platform.ts:159:5)
›      at BuildPlatform._run (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@oclif/command/lib/command.js:43:20)
›      at Config.runCommand (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@oclif/config/lib/config.js:173:24)
›      at Main.run (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@oclif/command/lib/main.js:28:9)
›      at Main._run (/home/gianluca/.nvm/versions/node/v18.15.0/lib/node_modules/@jovotech/cli/node_modules/@oclif/command/lib/command.js:43:20)

Your Environment

  • Jovo Framework version used: 4.5.11

It is fixed now.