Skip to content

TypeError: Cannot read property 'path' of undefined (v0.14.0 - absolute paths computation on Windows) #91

@somq

Description

@somq

Describe the bug

This PR breaks the plugin on Windows because absolute schema paths does not get computed properly.

sls offline start relevant log

# Note: Variables logs of getAppSyncConfig.js
getAppSyncConfig / schemaPaths [ 'graphql/schema.graphql' ]
getAppSyncConfig / basePath D:\_dev\_projects\redacted
globFilePaths / filePaths [ 'graphql/schema.graphql' ]
globFilePaths / basePath D:\_dev\_projects\redacted
globFilePaths / paths []
getAppSyncConfig / schemas []

 Type Error ----------------------------------------------

  TypeError: Cannot read property 'path' of undefined
      at getAppSyncConfig (D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\lib\getAppSyncConfig.js:254:38)
      at ServerlessAppSyncSimulator.initServer (D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\lib\index.js:85:50)
      at Client.<anonymous> (D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\lib\index.js:147:14)
      at Client.emit (events.js:210:5)
      at Client.EventEmitter.emit (domain.js:475:20)
      at BunserBuf.<anonymous> (D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\node_modules\fb-watchman\index.js:90:14)
      at BunserBuf.emit (events.js:210:5)
      at BunserBuf.EventEmitter.emit (domain.js:475:20)
      at BunserBuf.process (D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\node_modules\bser\index.js:292:10)
      at D:\_dev\_projects\redacted\node_modules\serverless-appsync-simulator\node_modules\bser\index.js:247:12
      at processTicksAndRejections (internal/process/task_queues.js:75:11)

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              12.14.0
     Framework Version:         2.35.0 (local)
     Plugin Version:            4.5.3
     SDK Version:               4.2.2
     Components Version:        3.8.3

To Reproduce
Run v0.15.0 on Windows

Expected behavior
Absolute schema paths should get computed properly

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions