Issues when deploying my serverless project in windows - serverless-framework

I have created a serverless boilerplate project using this command
sls create --template aws-nodejs-typescript --path my-project
I configured properly my AWS credantials thus I was able to depoly it successfully without any problem
sls deploy
But when I test de hello function I get the following error (after executing sls logs -f hello)
ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot
find module 'handler'\nRequire stack:\n-
/var/runtime/UserFunction.js\n-
/var/runtime/index.js","stack":["Runtime.ImportModuleError: Error:
Cannot find module 'handler '","Require stack:","-
/var/runtime/UserFunction.js","- /var/runtime/index.js"," at
_loadUserApp (/var/runtime/UserFunction.js:100:13)"," at Object.module.ex ports.load (/var/runtime/UserFunction.js:140:17)","
at Object. (/var/runtime/index.js:43:30)"," at
Module._compile (internal/modules/cjs/loader.js :999:30)"," at
Object.Module._extensions..js
(internal/modules/cjs/loader.js:1027:10)"," at Module.load
(internal/modules/cjs/loader.js:863:32)"," at Func
tion.Module._load (internal/modules/cjs/loader.js:708:14)"," at
Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:60:12)"," at intern
al/main/run_main_module.js:17:47"]} END RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 REPORT RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 Duration: 164.91 ms Billed
Duration: 165 ms Memory Size: 1024 MB Max Memory Used: 15 MB
Unknown application error occurred Runtime.ImportModuleError
I think the problem is in the Windows environment, because when I deploy the service with Mac it works with no issue ! Did I need an extra-configuration to use Serverless with windows ? Thanks for any suggestion

Related

Unable to read local json file on live Vercel site using getServerSideProps?

Im having issues deploying a project on Vercel. On my local machine the app is working as expected. Yet on the live site I'm running into a 500 internal error message. The project uses MongoDB and Next-Auth. In the .env.local file I created a env variable for NEXTAUTH_URL = localhost/3000. In Vercel, I created a NEXTAUTH_URL = "project-site" env variable for production. At the moment there isn't any MongoDB env variable set up. The error message in the function logs reads out
[GET] /_next/data/A8gtiRNZmw7m2Db85BoGe/suggestions.json
15:40:24:81
2022-05-26T19:40:26.691Z e41995a4-dac5-4f4e-aa1c-fbbcd2787d91 ERROR [Error: ENOENT: no such file or directory, open '/var/task/public/data/data.json'] {
errno: -2,
syscall: 'open',
path: '/var/task/public/data/data.json',
page: '/suggestions'
}
RequestId: e41995a4-dac5-4f4e-aa1c-fbbcd2787d91 Error: Runtime exited with error: exit status 1
Runtime.ExitError
Any tips are greatly appreciated.

Unable to find module error when trying to execute protractor tests

I have created a sample framework and am trying to login to my application
Below is a screenshot of my package structure
This is my LoginObjects.js which is present inside Pages folder
I am accessing this in my Spec\Login.js folder
When I execute my configuration.js I am getting this below error. Please let me know where I am going wrong
Failures:
Testing Login Page encountered a declaration exception
Message:
Error: Cannot find module './Pages/LoginObjects'
Require stack:
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\jasmine\lib\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\frameworks\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\runner.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\launcher.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\cli.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\bin\protractor
Stack:
Error: Cannot find module './Pages/LoginObjects'
Require stack:
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\jasmine\lib\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\frameworks\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\runner.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\launcher.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\cli.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\bin\protractor
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Suite.<anonymous> (C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js:5:15)
at Object.<anonymous> (C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js:2:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
1 spec, 1 failure
Finished in 2.136 seconds
you need to get out of the Specs folder first, then get in the Pages one.
Try with '../Pages/LoginObjects'

React-native/hermes build error. no such file or directory: index.android.bundle.packager.map

Description
Getting the following messages during build with hermesEnabled set to true
('...' represent removed text):
(full error log is here)
android\app\build\generated\assets\react\release\index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...
android\app\build\generated\assets\react\release\index.android.bundle:27:2907: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...
android\app\build\generated\assets\react\release\index.android.bundle:92:57773: warning: the variable "setTimeout" was not declared in function "wi"
...
fs.js:114
throw err;
^
Error: ENOENT: no such file or directory, open 'android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Object.<anonymous> (C:\esites-grocery\test2.hermes\plumpclient\node_modules\react-native\scripts\compose-source-maps.js:33:43)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
FAILURE: Build failed with an exception.
* Where:
Script 'node_modules\react-native\react.gradle' line: 191
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
(The referenced file exists, at least after the build failed).
Environment
Building on Windows 10
React Native version: 0.62.2
What I tried to do
Tried to bump soLoader to 0.8.0 and to 0.8.2 (although this is not supposed to be needed in RN 0.62.2) as suggested in https://github.com/facebook/react-native/issues/25927#issuecomment-539415154
Modifying the following extra packages definition in build.gradle:
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map"]
to
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/sourcemaps/react/release/index.android.bundle.packager.map"]
Fixed the error (the warnings are still there).
An APK is created and is running..
./gradlew clean
After doing the ./gradlew clean It worked for me.
OR
For Windows:
gralde clean

Error While Running Nodemon Server

When i try to run my file with nodemon src/app.js I get this error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Object.exports._errnoException (util.js:1008:11)
at exports._exceptionWithHostPort (util.js:1031:20)
at Server._listen2 (net.js:1253:14)
at listen (net.js:1289:10)
at Server.listen (net.js:1385:5)
at EventEmitter.listen (/Users/kevinmcnamara/express-dill/dill- website/node_modules/express/lib/application.js:617:24)
at Object.<anonymous> (/Users/kevinmcnamara/express-dill/dill-website/src/app.js:21:5)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
[nodemon] app crashed - waiting for file changes before starting...
I have tried running ps -w | grep node then running the kill command with the PID number I get running the previous command, but it returns a message saying - No such process.
Does anyone have any advice to get my express server running again?

LESS file watcher gives SyntaxError: Unexpected token during compilation

I have set up a LESS file watcher in Webstorm 9.0.2 to take my main.less file and compile it to main.css every time I save edits.
This is how I set it up:
This is what is in my main.less file
body {color:#fff}
However I get the following error in console during my compilation phase:
"C:/Program Files/nodejs/node.exe" main.less
E:\Ornico Work\socialdashboardAngular\app\styles\main.less:1
(function (exports, require, module, __filename, __dirname) { body {
^
SyntaxError: Unexpected token {
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Process finished with exit code 8
I am new to Webstorm and have very little idea what that error means and how to fix it. Could anyone out there please help me with this if at all possible?
Why do you use node.js to compile your .less files? Node itself can't do this - you need installing LESS compiler (npm install less -g) and specify a path to it as a program in your LESS file watcher.
Like:
Program: C:\Users\Your.Name\AppData\Roaming\npm\lessc.cmd
Arguments: --no-color $FileName$
Workingh dir: $FileDir$
Output paths: $FileNameWithoutExtension$.css
Make sure also to tick 'create output from stdout'