With no code changes and making sure the bundle fo...
# help
g
With no code changes and making sure the bundle format is set to cjs I get error saying:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
Anyone know how to resolve this?
t
where are you getting this?
can I see the full stack trace
g
Anytime a function is set to run it occurs heres the full log:
Copy code
Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","reason":"Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","    at process.<anonymous> (file:///C:/Users/PC/Documents/Softgiving/platform-sst/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (events.js:400:28)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
Looks like everything works on my mac just fine so I assume this is on SST's end as to why windows doesnt work?
t
Yeah I see. can I see how you're defining the function?
g
Sure one is just:
Copy code
props.api.addRoutes(this, {
  'GET /public/overlays/stats/{id}': {
    function: {
      handler: 'src/functions/http/public/overlays/stats.handler',
      permissions: [props.resources.Dynamo],
      environment: {
        DYNAMO_TABLE_NAME: props.resources.Dynamo.tableName,
		DYNAMO_TABLE_ARN: props.resources.Dynamo.tableArn
      }
    }
  }
})
j
Hello, im having the same issue on my windows machine, when calling lambda via api:
Copy code
const getMyTodosRoute: ApiFunctionRouteProps = {
      function: {
        handler: 'src/todos/getMyTodos.handler',
        environment: { todosTable: todosTable.tableName },
        permissions: [todosTable],
        bundle: {
          format: 'cjs', // or esm, issue is present on either option
        },
      },
    };
I'm on sst 0.60.2 and node 14.16.1
t
yeah there's an issue on windows right now where the file is passed as
import("<c://my/lambda//handler.js>")
which isn't allowed. Let me try and get a fix for this today
You can rollback to 59.x and it should work
j
Yep, downgraded to 0.59.1 and all works. Thanks for the quick response 🤗
t
Are any of you around to test a canary release to see if the windows issue is fixed?
Copy code
sst update 0.60.3-next.3+b863210b
j
on it
@thdxr updated to
0.60.3-next.3
but error still persists:
Copy code
Unhandled Promise Rejection     {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","reason":"Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'","    at process.<anonymous> (file:///C:/Users/user/Documents/sst-getting-started/server/node_modules/@serverless-stack/aws-lambda-ric/lib/index.js:34:23)","    at process.emit (events.js:315:20)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:94:32)"]}
t
hm
can you send me your .build/sst-debug.log
j
sure, it doesnt contain sensitive data, does it? 😅