I am trying to deploy Next.js app on AWS Amplify but it keep fails.
Build worked perfectly fine in local environment and I even succeeded to deploy on Vercel.
But it only fails on Amplify :(
I was able to deploy by creating a .babelrc file, but I am looking for a better solution of keeping SWC.
I tried:
rm package-lock.json && rm -rf node_modules and reinstall (npm install --force)
Install #next/swc-linux-x64-gnu and #next/swc-linux-x64-musl as optionalDependencies
Set swcMinify option to false in next.config.js
Remove compiler option in next.config.js
▼ Environment
v16.13.2 x64 linux
▼ package.json
{
"name": "my-project",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#svgr/webpack": "^6.2.1",
"clsx": "^1.2.1",
"framer-motion": "^6.4.3",
"next": "12.2.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-query": "^3.39.1",
"react-use": "^17.4.0",
"recoil": "^0.7.4",
"styled-components": "^5.3.5",
"twemoji": "^14.0.2"
},
"devDependencies": {
"#types/node": "18.0.3",
"#types/react": "18.0.15",
"#types/react-dom": "18.0.6",
"#types/styled-components": "^5.1.25",
"eslint": "8.19.0",
"eslint-config-next": "12.2.2",
"typescript": "4.7.4"
}
}
▼ next.config.js
/** #type {import('next').NextConfig} */
const nextConfig = {
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ['#svgr/webpack'],
})
return config
},
reactStrictMode: true,
swcMinify: true,
compiler: {
styledComponents: {
displayName: true,
ssr: true,
},
},
}
module.exports = nextConfig
▼ Error logs
# Starting phase: preBuild
# Executing command: nvm use --lts
2022-07-13T23:48:13.094Z [INFO]: Now using node v16.13.2 (npm v8.1.2)
2022-07-13T23:48:13.095Z [INFO]: # Executing command: node -e 'console.log(process.version, process.arch, process.platform)'
2022-07-13T23:48:13.122Z [INFO]: v16.13.2 x64 linux
2022-07-13T23:48:13.125Z [INFO]: # Executing command: npm ci --include=optional
2022-07-13T23:48:20.109Z [WARNING]: npm
2022-07-13T23:48:20.111Z [WARNING]: WARN deprecated stable#0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
2022-07-13T23:48:27.374Z [INFO]: added 508 packages, and audited 509 packages in 14s
2022-07-13T23:48:27.377Z [INFO]: 100 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
2022-07-13T23:48:27.389Z [INFO]: # Completed phase: preBuild
2022-07-13T23:48:27.389Z [INFO]: # Starting phase: build
# Executing command: npm run build
2022-07-13T23:48:27.663Z [INFO]: > my-project#0.1.0 build
> next build
2022-07-13T23:48:28.057Z [INFO]: info - SWC minify release candidate enabled. https://nextjs.link/swcmin
2022-07-13T23:48:28.065Z [INFO]: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
2022-07-13T23:48:28.086Z [INFO]: Attention: Next.js now collects completely anonymous telemetry regarding usage.
2022-07-13T23:48:28.086Z [INFO]: This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
2022-07-13T23:48:28.174Z [INFO]: info - Linting and checking validity of types...
2022-07-13T23:48:33.726Z [INFO]: info - Creating an optimized production build...
2022-07-13T23:48:34.350Z [INFO]: info - Downloading WASM swc package...
2022-07-13T23:48:35.445Z [INFO]: info - Using experimental wasm build of next-swc
2022-07-13T23:48:35.613Z [WARNING]: warn - Attempted to load #next/swc-linux-x64-gnu, but an error occurred: libssl.so.1.1: cannot open shared object file: No such file or directory
2022-07-13T23:48:35.614Z [WARNING]: warn - Attempted to load #next/swc-linux-x64-gnux32, but it was not installed
warn - Attempted to load #next/swc-linux-x64-musl, but an error occurred: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
2022-07-13T23:48:48.873Z [WARNING]: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: IOError(Error { kind: Unsupported, message: "operation not supported on this platform" }) }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
Stack:
Error
at module.exports.__wbg_new_693216e109162396 (/codebuild/output/src358588912/src/my-project/node_modules/next/wasm/#next/swc-wasm-nodejs/wasm.js:202:17)
at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
2022-07-13T23:48:48.911Z [WARNING]: panicked at 'The global thread pool has not been initialized.: ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.1/src/registry.rs:170:10
Stack:
Error
at module.exports.__wbg_new_693216e109162396 (/codebuild/output/src358588912/src/my-project/node_modules/next/wasm/#next/swc-wasm-nodejs/wasm.js:202:17)
at wasm://wasm/059aa236:wasm-function[5445]:0xf90917
at wasm://wasm/059aa236:wasm-function[13700]:0x11eca7b
at wasm://wasm/059aa236:wasm-function[9995]:0x1186adc
at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
2022-07-13T23:48:49.415Z [WARNING]: Failed to compile.
static/chunks/pages/_app-8aa2b8cf1034125e.js from Terser
unreachable
RuntimeError: unreachable
at wasm://wasm/059aa236:wasm-function[9995]:0x1186aff
at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
at wasm://wasm/059aa236:wasm-function[654]:0x760098
at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
static/chunks/framework-a1d4bfd54c97f1bc.js from Terser
unreachable
RuntimeError: unreachable
at wasm://wasm/059aa236:wasm-function[9995]:0x1186afd
at wasm://wasm/059aa236:wasm-function[11009]:0x11b6862
at wasm://wasm/059aa236:wasm-function[12785]:0x11e5cdd
at wasm://wasm/059aa236:wasm-function[11383]:0x11c358f
at wasm://wasm/059aa236:wasm-function[10017]:0x1187e72
at wasm://wasm/059aa236:wasm-function[1151]:0x98decd
at wasm://wasm/059aa236:wasm-function[654]:0x75f3f2
at wasm://wasm/059aa236:wasm-function[654]:0x760098
at wasm://wasm/059aa236:wasm-function[3154]:0xd6fe73
at wasm://wasm/059aa236:wasm-function[654]:0x75f24f
2022-07-13T23:48:49.417Z [WARNING]:
2022-07-13T23:48:49.417Z [WARNING]: > Build failed because of webpack errors
2022-07-13T23:48:49.456Z [ERROR]: !!! Build failed
2022-07-13T23:48:49.457Z [ERROR]: !!! Non-Zero Exit Code detected
2022-07-13T23:48:49.457Z [INFO]: # Starting environment caching...
2022-07-13T23:48:49.457Z [INFO]: # Uploading environment cache artifact...
2022-07-13T23:48:49.532Z [INFO]: # Environment caching completed
Terminating logging...
Downgrade nextjs version to 12.2.0 and should work fine!!
Detail here: https://github.com/vercel/next.js/issues/38436
I think it is because of the SwcMinify or the TypeScript plugins.
I had the same issue and I disabled SwcMinify and edited the TypeScript plugins in .eslintrc.json.
"plugins": ["#typescript-eslint/eslint-plugin"],
"extends": [
"eslint:recommended",
"next/core-web-vitals",
"plugin:#typescript-eslint/eslint-recommended",
"plugin:#typescript-eslint/recommended",
"prettier"
],
I had the same problem, to solve it, I had to delete completely the node_modules folder and reinstall all packages with yarn install.
Related
I followed this answer already. But it didn't help, also, I re-installed gcloud CLI, but now I am not able to install CLI anymore because of the following error.
Here is my output for ./google-cloud-sdk/bin/gcloud init
ERROR: Reachability Check failed.
Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with httplib2 (SSLCertVerificationError)
Cannot reach https://www.googleapis.com/auth/cloud-platform with httplib2 (SSLCertVerificationError)
Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects with requests (SSLError)
Cannot reach https://www.googleapis.com/auth/cloud-platform with requests (SSLError)
Network connection problems may be due to proxy or firewall settings.
Also, I am not behind any corporate proxy.
It was working perfectly few days ago, until today.I did not changed any settings whatsoever, I didn't install any new services whatsoever.
Output for ./google-cloud-sdk/bin/gcloud info.
./google-cloud-sdk/bin/gcloud info
Google Cloud SDK [354.0.0]
Python Version: [3.7.9 (v3.7.9:13c94747c7, Aug 15 2020, 01:31:08) [Clang 6.0 (clang-600.0.57)]]
Python Location: [/Users/myname/.config/gcloud/virtenv/bin/python3]
Site Packages: [Enabled]
Installation Root: [/Users/myname/Downloads/google-cloud-sdk]
Installed Components:
gsutil: [4.67]
core: [2021.08.20]
bq: [2.0.71]
System PATH: [/Users/myname/.config/gcloud/virtenv/bin:/Users/myname/Downloads/apache-maven-3.8.4/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/munki:/usr/local/opt/go/libexec/bin:/Users/myname/go/bin]
Python PATH: [/Users/myname/Downloads/./google-cloud-sdk/lib/third_party:/Users/myname/Downloads/google-cloud-sdk/lib:/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7:/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload:/Users/myname/.config/gcloud/virtenv/lib/python3.7/site-packages]
Cloud SDK on PATH: [False]
Kubectl on PATH: [/usr/local/bin/kubectl]
Installation Properties: [/Users/myname/Downloads/google-cloud-sdk/properties]
User Config Directory: [/Users/myname/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/Users/myname/.config/gcloud/configurations/config_default]
Account: [None]
Project: [None]
Current Properties:
[core]
disable_usage_reporting: [True]
Logs Directory: [/Users/myname/.config/gcloud/logs]
Last Log File: [/Users/myname/.config/gcloud/logs/2022.08.10/15.35.06.807614.log]
git: [git version 2.32.0 (Apple Git-132)]
ssh: [OpenSSH_8.1p1, LibreSSL 2.7.3]
Update on this, just disable the ssl validation and everything will work.
gcloud config set auth/disable_ssl_validation True
I want to debug locally my Lambda, and after config AWS SAM and AWS Toolkit, I'm able to run sam build but when I try to invoke the function or, most important, run in vscode debug mode, I get this error for (i think) docker:
2022-06-06 16:51:08 [INFO]: Preparing to debug locally: Lambda "lambda_function.lambda_handler"
2022-06-06 16:51:08 [INFO]: Building SAM application...
2022-06-06 16:51:10 [INFO]: Command: (not started) [C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd build --build-dir C:\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output --template C:/Users/poliian/AppData/Local/Temp/aws-toolkit-vscode/vsctkUxOcxJ/app___vsctk___template.yaml --base-dir C:/Users/poliian/git/EU8/informacoesfiscaislegais-automacaooslambdaespec --manifest C:\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\debug-requirements.txt]
2022-06-06 16:51:13 [INFO]: Building codeuri: C:/Users/poliian/git/EU8/informacoesfiscaislegais-automacaooslambdaespec runtime: python3.9 metadata: {} architecture: x86_64 functions: ['informacoesfiscaislegaisautomacaooslambdaespec']
2022-06-06 16:51:14 [INFO]: Running PythonPipBuilder:ResolveDependencies
2022-06-06 16:51:19 [INFO]: Running PythonPipBuilder:CopySource
2022-06-06 16:51:19 [INFO]:
Build Succeeded
2022-06-06 16:51:19 [INFO]:
Built Artifacts : ..\..\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output
Built Template : ..\..\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output\template.yaml
Commands you can use next
=========================
[*] Validate SAM template: sam validate
[*] Invoke Function: sam local invoke -t ..\..\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output\template.yaml
[*] Test Function in the Cloud: sam sync --stack-name {stack-name} --watch
[*] Deploy: sam deploy --guided --template-file ..\..\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output\template.yaml
2022-06-06 16:51:20 [INFO]: Build complete.
2022-06-06 16:51:20 [INFO]: Starting SAM application locally
2022-06-06 16:51:25 [INFO]: AWS.running.command
Invoking lambda_function.lambda_handler (python3.9)
Skip pulling image and use local one: public.ecr.aws/sam/emulation-python3.9:rapid-1.51.0-x86_64.
Mounting C:\Users\poliian\AppData\Local\Temp\aws-toolkit-vscode\vsctkUxOcxJ\output\informacoesfiscaislegaisautomacaooslambdaespec as /var/task:ro,delegated inside runtime container
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\docker\api\client.py", line 261, in _raise_for_status
response.raise_for_status()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\lib\site-packages\requests\models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localnpipe/v1.35/containers/create
During handling of the above exception, another exception occurred:
docker.errors.APIError: 500 Server Error: Internal Server Error ("b'status code not OK but 500: \x00\x01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x0c\x02\x00\x00\x00BDocker.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\x05\x01\x00\x00\x00\x1bDocker.Core.DockerException\x0c\x00\x00\x00\tClassName\x07Message\x04Data\x0eInnerException\x07HelpURL\x10StackTraceString\x16RemoteStackTraceString\x10RemoteStackIndex\x0fExceptionMethod\x07HResult\x06Source\rWatsonBuckets\x01\x01\x03\x03\x01\x01\x01\x00\x01\x00\x01\x07\x1eSystem.Collections.IDictionary\x10System.Exception\x08\x08\x02\x02\x00\x00\x00\x06\x03\x00\x00\x00\x1bDocker.Core.DockerException\x06\x04\x00\x00\x00\x1eFilesharing has been cancelled\n\n\n\x06\x05\x00\x00\x00\x8c\x13 at Docker.ApiServices.Mounting.FileSharing.<DoShareAsync>d__7.MoveNext() in C:\\workspaces\\PR-16070\\src\\github.com\\docker\\pinata\\win\\src\\Docker.ApiServices\\Mounting\\FileSharing.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Docker.ApiServices.Mounting.FileSharing.<ShareAsync>d__5.MoveNext() in C:\\workspaces\\PR-16070\\src\\github.com\\docker\\pinata\\win\\src\\Docker.ApiServices\\Mounting\\FileSharing.cs:line 53\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Docker.HttpApi.Controllers.FilesharingController.<ShareDirectory>d__2.MoveNext() in C:\\workspaces\\PR-16070\\src\\github.com\\docker\\pinata\\win\\src\\Docker.HttpApi\\Controllers\\FilesharingController.cs:line 21\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Threading.Tasks.TaskHelpersExtensions.<CastToObject>d__1`1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()\n\x00\x00\x00\x00\x06\x06\x00\x00\x00\x9f\x018\nMoveNext\nDocker.ApiServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null\nDocker.ApiServices.Mounting.FileSharing+<DoShareAsync>d__7\nVoid MoveNext()\x00\x15\x13\x80\x06\x07\x00\x00\x00\x12Docker.ApiServices'")
Command stopped: "sam local invoke"
2022-06-06 16:51:28 [ERROR]: Failed to run SAM application locally: "sam local invoke" command stopped (error code: 1)
I tried to configure docker File Sharing to AppData\Local\Temp\aws-toolkit-vscode path.
One important thing is that I'm on my business env so I don't know if this is an access problem or docker config problem, because when I try to run on my personal notebook run normally.
My launch.json as well:
{
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "informacoesfiscaislegais-automacaooslambdaespec:DevHello",
"invokeTarget": {
"target": "template",
"templatePath": "${workspaceFolder}/app/template.yaml",
"logicalId": "DevHello"
},
"lambda": {
"payload": {},
"environmentVariables": {}
}
},
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "informacoesfiscaislegais-automacaooslambdaespec:DevHello",
"invokeTarget": {
"target": "template",
"templatePath": "${workspaceFolder}/app/template.yaml",
"logicalId": "DevHello"
},
"lambda": {
"runtime": "python3.9",
"payload": {},
"environmentVariables": {}
}
}
]
}
Edit 1:
When I Use the WSL 2 based engine I get a new error (and the previously error happening when I turn it of):
I don't know what can be this. I already searched on google, stack, github, aws pages and I can find any solution for this.
I'm trying to deploy a serverless yaml file that makes use of the serverless-aws-alias plugin. It used to work (like a couple of years ago) but today, it started erroring out and no matter which combination of versions I test, it fails. Here are a few different scenarios and error messages I face:
sls deploy --region us-east-1
Serverless Warning --------------------------------------
CLI options definitions were upgraded with "type" property (which could be one of "string", "boolean", "multiple"). Below listed plugins do not predefine type for introduced options:
- AwsAlias for "alias", "verbose"
Please report this issue in plugin issue tracker.
Serverless: Configuration warning at 'provider': unrecognized property 'alias'
Serverless:
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Type Error ----------------------------------------------
TypeError: this.aliasStackGetAliasStackNames(...).mapSeries is not a function
at AwsAlias.aliasStackLoadAliasTemplates (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/serverless-aws-alias/lib/stackInformation.js:82:4)
at AwsAlias.tryCatcher (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:466:21)
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: linux
Node Version: 16.14.2
Framework Version: 2.72.3 (local)
Plugin Version: 5.5.4
SDK Version: 4.3.2
Components Version: 3.18.2
Serverless: Deprecation warning: Resolution of lambda version hashes was improved with better algorithm, which will be used in next major release.
Switch to it now by setting "provider.lambdaHashingVersion" to "20201221".
While it is highly encouraged to upgrade to new algorithm, you can still use the old approach by setting "provider.lambdaHashingVersion" to "20200924".
More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
Serverless Error ----------------------------------------
ServerlessError: Export 'Test-dev-ServerlessAliasReference' does not exist.
at /home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/serverless/lib/aws/request.js:226:11
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async persistentRequest (/home/mehran/Telus/git/solution/repositories/ihsdmdevelopers/commons/sso/server/node_modules/serverless/lib/aws/request.js:150:14)
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: linux
Node Version: 16.14.2
Framework Version: 2.72.3 (local)
Plugin Version: 5.5.4
SDK Version: 4.3.2
Components Version: 3.18.2
sls deploy --region us-east-1
Serverless: Deprecation warning: Local installation of Serverless detected. Starting with next major version, CLI will run it instead of globally installed version.
Set "enableLocalInstallationFallback" to "true" to switch to new behavior now, set to "false" to keep current behavior and hide this message
More Info: https://www.serverless.com/framework/docs/deprecations/#LOCAL_INSTALLATION_FALLBACK
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless Error ---------------------------------------
Export 'Test-dev-ServerlessAliasReference' does not exist.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 16.14.2
Framework Version: 1.83.3
Plugin Version: 3.8.4
SDK Version: 2.3.2
Components Version: 2.34.9
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Preparing alias ...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service Test.zip file to S3 (50.18 MB)...
Error --------------------------------------------------
Error: Unknown object type "asyncfunction"
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:218:17)
at Object._function (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:319:14)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object._function (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:319:14)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at /usr/lib/node_modules/serverless/node_modules/object-hash/index.js:246:18
at Array.forEach (<anonymous>)
at Object._object (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:242:21)
at Object.dispatch (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:185:30)
at hash (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:128:10)
at objectHash (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:33:10)
at Function.exports.sha1 (/usr/lib/node_modules/serverless/node_modules/object-hash/index.js:44:10)
at AwsProvider.request (/usr/lib/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:234:35)
at AwsDeploy.uploadZipFile (/usr/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/uploadArtifacts.js:76:26)
at BbPromise.map.concurrency (/usr/lib/node_modules/serverless/lib/plugins/aws/deploy/lib/uploadArtifacts.js:127:21)
at tryCatcher (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
at MappingPromiseArray._promiseFulfilled (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/map.js:68:38)
at MappingPromiseArray.PromiseArray._iterate (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:115:31)
at MappingPromiseArray.init (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/promise_array.js:79:10)
at MappingPromiseArray._asyncInit (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/map.js:37:10)
at _drainQueueStep (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:466:21)
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: linux
Node Version: 16.14.2
Framework Version: 1.61.2
Plugin Version: 3.8.4
SDK Version: 2.3.2
Components Core Version: 1.1.2
Components CLI Version: 1.6.0
For the sake of test, I kept the yaml file as simple as possible. Just a single lambda function. BTW, I tested different versions of the serverless since poeple were saying that downgrading was fixing it for them. But for me, no version works. No matter what!
One last thing, if I eliminate the serverless-aws-alias plugin from the yaml file, it will deploy. But I need the alias so I need to make it work with the plugin.
For the sake of completeness, here's my package.json:
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws-sdk": "^2.1125.0"
},
"devDependencies": {
"serverless-aws-alias": "^1.8.0",
"serverless-prune-plugin": "^1.3.2",
"serverless-pseudo-parameters": "^2.2.0"
}
}
I followed the tutorial on https://cloud.google.com/dataproc/docs/concepts/compute/gpus and created a single-node n1-standard-16 Dataproc cluster (base image is: 1.5.35-debian10) and attached Tesla T4 GPU. I installed NVIDIA drivers after creating the cluster and I was able to run my Spark jobs that run on GPU successfully.
However when I stop the master instance, start it again and submit a new Dataproc job, it fails with "Task was not acquired" after 5 minutes, and couldn't find any way to run jobs in the same cluster.
Any help is appreciated.
Edit: After investigating hadoop-yarn logs at /var/log/hadoop-yarn folder as suggested by #Dagang, it seems that it's related to YARN Node Manager. Node manager fails with the following messages.
Edit2: The main failure reason is "Unexpected: Cannot create yarn cgroup Subsystem:devices Mount points:/proc/mounts User:yarn Path:/sys/fs/cgroup/devices/yarn". As suggested in Hadoop official website:, the following lines need to run in the installation script:
chown :yarn -R /sys/fs/cgroup/cpu,cpuacct
chmod g+rwx -R /sys/fs/cgroup/cpu,cpuacct
chown :yarn -R /sys/fs/cgroup/devices
chmod g+rwx -R /sys/fs/cgroup/devices
However these commands already exist in install_gpu_drivers.sh
Complete error log:
Specified path is a directory, use nvidia-smi under the directory, updated path-to-executable
:/usr/bin/nvidia-smi
Trying to discover GPU information ...
=== Gpus in the system ===
Driver Version:460.73.01
ProductName=Tesla T4, MinorNumber=0, TotalMemory=15109MiB, Utilization=0.0%
CGroup controller already mounted at: /sys/fs/cgroup/devices
Initializing mounted controller devices at /sys/fs/cgroup/devices/yarn
Yarn control group does not exist. Creating /sys/fs/cgroup/devices/yarn
Failed to bootstrap configured resource subsystems!
Unexpected: Cannot create yarn cgroup Subsystem:devices Mount points:/proc/mounts User:yarn Path:/sys/fs/cgroup/de
vices/yarn
at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializePreMountedCGroupController(CGroupsHandlerImpl.java:424)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializeCGroupController(CGroupsHandlerImpl.java:376)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.gpu.GpuResourceHandlerImpl.bootstrap(GpuResourceHandlerImpl.java:86)
at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerChain.bootstrap(ResourceHandlerChain.java:58)
at org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor.init(LinuxContainerExecutor.java:316)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:391)
at org.apache.hadoop.service.AbstractService.init(AbstractService.java:164)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNodeManager(NodeManager.java:878)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManager.java:946)
2021-09-17 07:18:56,215 INFO org.apache.hadoop.service.AbstractService: Service NodeManager failed in state INITED; cause: org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to initialize container execu
tor
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to initialize container executor
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:393)
at org.apache.hadoop.service.AbstractService.init(AbstractService.java:164)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNodeManager(NodeManager.java:878)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManager.java:946)
Caused by: java.io.IOException: Failed to bootstrap configured resource subsystems!
at org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor.init(LinuxContainerExecutor.java:320)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:391)
... 3 more
2021-09-17 07:18:56,216 ERROR org.apache.hadoop.yarn.server.nodemanager.NodeManager: Error starting NodeManager
org.apache.hadoop.yarn.exceptions.YarnRuntimeException: Failed to initialize container executor
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:393)
at org.apache.hadoop.service.AbstractService.init(AbstractService.java:164)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNodeManager(NodeManager.java:878)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManager.java:946)
Caused by: java.io.IOException: Failed to bootstrap configured resource subsystems!
at org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor.init(LinuxContainerExecutor.java:320)
at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:391)
... 3 more
2021-09-17 07:18:56,219 INFO org.apache.hadoop.yarn.server.nodemanager.NodeManager: SHUTDOWN_MSG:
How to reproduce:
I use Google Dataproc Node.js Client library to create Dataproc clusters. Here is my configuration:
request: ClusterCreateInput = {
projectId: 'my-project-id',
region: 'europe-west-1',
cluster: {
projectId: 'my-project-id',
clusterName: 'test-cluster',
config: {
configBucket: 'my-dataproc-log-bucket',
gceClusterConfig: {
zoneUri: 'europe-west-1-d',
serviceAccountScopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud.useraccounts.readonly',
'https://www.googleapis.com/auth/devstorage.read_write',
'https://www.googleapis.com/auth/logging.write',
],
},
masterConfig: {
numInstances: 1,
machineTypeUri: `n1-standard-16`,
diskConfig: {
bootDiskSizeGb: 100,
bootDiskType: 'pd-standard',
numLocalSsds: 0,
},
accelerators: [
{
acceleratorTypeUri: 'nvidia-tesla-t4',
acceleratorCount: 1,
},
],
imageUri: '1.5.35-debian10',
},
softwareConfig: {
properties: {
'dataproc:dataproc.allow.zero.workers': true,
'spark:spark.executor.instances': '1',
'spark:spark.executor.cores': '16',
'spark:spark.default.parallelism': '16',
'spark:spark.executor.memory': `38000m`,
'spark-env:ARROW_PRE_0_15_IPC_FORMAT': '1',
'spark:spark.executorEnv.LD_PRELOAD': 'libnvblas.so',
},
},
initializationActions: [
{
executableFile: `gs://my-bucket-name/install_gpu_driver.sh`,
},
],
},
},
}
const [clusterOperation] = await this.client.createCluster(request)
const [result] = await clusterOperation.promise()
After creating the cluster, submit a basic job. Stop and start the VM when the job is completed and re-submit a similar job. The cluster will not acquire this new job.
I have been banging my head on this for a few days and I am coming up empty. I have an API that I can run locally just fine via the command line-
sam local start-api
or
sam local invoke HelloWorldFunction
I USED to be able to run the same api via my launch.json configuration as well but suddenly for no reason I have been able to identify, I am now getting:
2021-05-19 12:18:32 [ERROR]: Timeout while waiting for command: "sam local start-api"
2021-05-19 12:18:32 [ERROR]: Failed to start local API Gateway: Timeout while waiting for command: "sam local start-api"
2021-05-19 12:18:32 [INFO]: Sending request to local API: http://127.0.0.1:5858/hello?
My launch.json looks like this:
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "Simple API lambda-nodejs14.x:HelloWorldFunction (nodejs14.x)",
"invokeTarget": {
"target": "api",
"templatePath": "${workspaceFolder}/lambda-nodejs14.x/template.yaml",
"logicalId": "HelloWorldFunction"
},
"api": {
"path": "/hello",
"httpMethod": "get",
"payload": {
"json": {}
}
},
"lambda": {
"runtime": "nodejs14.x"
},
"sam": {},
"aws":{}
}
I have reduced this to the simplest possible scenario by trying with the helloWorld test project.
My aws_toolkit log looks like this:
2021-05-19 12:27:07 [INFO]: Build complete. 2021-05-19 12:27:07
[INFO]: Starting SAM application locally 2021-05-19 12:27:07 [INFO]:
Running: (not started) [C:\Program Files\Amazon\AWSSAMCLI\bin\sam.cmd
local start-api --template
C:\Users\USERTEST\AppData\Local\Temp\aws-toolkit-vscode\vsctklc1oS3\output\template.yaml
--env-vars C:\Users\USERTEST\AppData\Local\Temp\aws-toolkit-vscode\vsctklc1oS3\env-vars.json
--port 5858 --debug-port 5859] 2021-05-19 12:27:07 [INFO]: AWS.running.command 2021-05-19 12:27:07 [ERROR]: Timeout while waiting
for command: "sam local start-api" 2021-05-19 12:27:07 [ERROR]: Failed
to start local API Gateway: Timeout while waiting for command: "sam
local start-api" 2021-05-19 12:27:07 [WARN]: [Error: Timeout while
waiting for command: "sam local start-api" at
c:\Users\BogartLisa.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.25.0\dist\extension.js:2452:1782
at async lv.invoke
(c:\Users\BogartLisa.vscode\extensions\amazonwebservices.aws-toolkit-vscode-1.25.0\dist\extension.js:2452:1677)]
2021-05-19 12:27:07 [INFO]: Sending request to local API:
http://127.0.0.1:5858/hello? 2021-05-19 12:27:07 [VERBOSE]: SAM:
command exited (code: null): PID 14376: [C:\Program
Files\Amazon\AWSSAMCLI\bin\sam.cmd local start-api --template
C:\Users\USERTEST\AppData\Local\Temp\aws-toolkit-vscode\vsctklc1oS3\output\template.yaml
--env-vars C:\Users\USERTEST\AppData\Local\Temp\aws-toolkit-vscode\vsctklc1oS3\env-vars.json
--port 5858 --debug-port 5859] 2021-05-19 12:27:12 [INFO]: Successfully sent a telemetry batch of 1 2021-05-19 12:27:13 [ERROR]:
Local API failed to respond (ECONNREFUSED) after 30 retries, path:
/hello
My vs code:
Version: 1.56.2 (user setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.17134
aws --version
aws-cli/2.1.27 Python/3.7.9 Windows/10 exe/AMD64 prompt/off
Does Anyone have any ideas for me?? I am out of ideas
The answer to this problem was to increase the configured max time to wait to attach to the sam cli:
Settings > Extensions > AWS Configuration > Samcli > Debug > Attach > Timeout:Millis
Maximum time (in milliseconds) to wait for SAM output while starting a Local Lambda session
Mine was set at the default of 30 seconds and unfortunately for me, it was taking in excess of 1.5 minutes to attach (but that's a whole 'nother problem).