Prisma1: Unable to import module 'src\\email-password\\signup-lambda' on Windows

Created on 15 Oct 2017  路  10Comments  路  Source: prisma/prisma1

"logs": [
    {
      "START RequestId: a95a2f2f-": "b1c6-11e7-af17-e1bfe467d931 Version: $LATEST\nUnable to import module 'src\\email-password\\signup-lambda': Error\n    at Function.Module._resolveFilename (module.js:469:15)\n    at Function.Module._load (module.js:417:25)\n    at Module.require (module.js:497:17)\n    at require (internal/module.js:20:19)\nEND RequestId: a95a2f2f-b1c6-11e7-af17-e1bfe467d931\nREPORT RequestId: a95a2f2f-b1c6-11e7-af17-e1bfe467d931\tDuration: 51.09 ms\tBilled Duration: 100 ms \tMemory Size: 512 MB\tMax Memory Used: 19 MB\t\n"
    }
  ],
  "returnValue": {
    "errorMessage": "Cannot find module '/var/task/src\\email-password\\signup-lambda'",
    "errorType": "Error",
    "stackTrace": [
      "Function.Module._load (module.js:417:25)",
      "Module.require (module.js:497:17)",
      "require (internal/module.js:20:19)"
    ]
  }
bu2-confirmed arecli

All 10 comments

This is fixed and will be released in version 0.8 馃檪

Getting a similar problem with 0.8.0-alpha.5. Running graphcool init and graphcool deploy then trying to query the hello function. Running Windows 10 with Node 8.4.0.
Log:

  "logs": [
    "START RequestId: 03471105-b1dc-11e7-8012-b7796e737c07 Version: $LATEST\nUnable to import module 'src\\hello-lambda': Error\n    at Function.Module._load (module.js:417:25)\n    at Module.require (module.js:497:17)\n    at require (internal\/module.js:20:19)\nEND RequestId: 03471105-b1dc-11e7-8012-b7796e737c07\nREPORT RequestId: 03471105-b1dc-11e7-8012-b7796e737c07\tDuration: 1.23 ms\tBilled Duration: 100 ms \tMemory Size: 512 MB\tMax Memory Used: 20 MB\t\n"
  ],
  "returnValue": {
    "errorMessage": "Cannot find module '\/var\/task\/src\\hello-lambda'",
    "errorType": "Error",
    "stackTrace": [
      "Module.require (module.js:497:17)",
      "require (internal\/module.js:20:19)"
    ]
  }

Looking in an old build.zip (0.7.0) shows that theres 2 hello.js with identical names in the src directory. The compiled version(?) and the regular one. Might be something to go on? EDIT: No duplicate files in 0.8.0, still the same error though.

@kraffslol thanks for reporting! In 0.8.0-alpha.5 I can't reproduce this anymore.
Could you create a small github project where this problem occurs?
Thanks!

@timsuchanek Sure thing! Repo at https://github.com/kraffslol/graphcoolinittest. Included the build files if you want to look at those aswell.

Looked into it a bit more. Tried the same process both on my desktop computer (Windows 10) and laptop (MacOS High Sierra). Works just fine on MacOS but not on Windows 10. With debug enabled I found something that looked off. Under "Sending project definition":

"lambdaHandler": "src\\hello-lambda.handle",
"devHandler": "src\\hello-dev.js"

On MacOS it shows as:

"lambdaHandler": "src/hello-lambda.handle",
"devHandler": "src/hello-dev.js"

Checking the error log above it seems to be related. Looks like "src\hello-lambda" is being interpreted as a filename instead of a path.

That looks to be likely! Thanks a lot for looking closer into this.

Thanks to @kbrandwijk I managed to track down the part which gave the incorrect path.
https://github.com/graphcool/graphcool/blob/02553661b5dddfaba8f07f64245a04bdb59f0a54/cli/packages/graphcool-cli-core/src/commands/deploy/Bundler/Bundler.ts#L265
Changing it to path.posix.join made the paths identical to the ones on MacOS. Although it still isn't working, the error remains the same. The zip looks fine and the js files are identical to the one on my MacOS laptop. I suspect that something is not working with the upload proccess.

That's actually a very weird line, calling path.join on a single value. I think that should have been path.normalize, @timsuchanek?

This is now released in 0.9.1: https://github.com/graphcool/framework/releases/tag/0.9.1 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hoodsy picture hoodsy  路  3Comments

ragnorc picture ragnorc  路  3Comments

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments