mapbox / mapbox/asset-tracking

API Endpoint url giving "internal server error" message

Open
#11 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
83
Forks
29
PR merge metrics
No merged PRs in 30d

Description

After following all the steps for this project when I run the stack API endpoint URL i get the following message:
{"message": "Internal server error"}

Since i am new to cloud computing (AWS, pulumi, etc) i am not sure where the problem lies.

My infrastructure preview was slightly different from the instructions ss as below:
Screen Shot 2021-10-12 at 12 48 09 PM

Checking the logs in cloudwatch i came across the following error:

2021-10-12T16:03:44.361Z 1605df3c-6d01-418b-9df1-7b863f2e3087 ERROR Invoke Error {
"errorType": "Error",
"errorMessage": "Package subpath './dist/js/index.js' is not defined by \"exports\" in /var/task/node_modules/@turf/helpers/package.json",
"code": "ERR_PACKAGE_PATH_NOT_EXPORTED",
"stack": [
"Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/js/index.js' is not defined by \"exports\" in /var/task/node_modules/@turf/helpers/package.json",
" at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)",
" at packageExportsResolve (internal/modules/esm/resolve.js:522:3)",
" at resolveExports (internal/modules/cjs/loader.js:424:36)",
" at Function.Module._findPath (internal/modules/cjs/loader.js:464:31)",
" at Function.Module._resolveFilename (internal/modules/cjs/loader.js:802:27)",
" at Function.Module._load (internal/modules/cjs/loader.js:667:27)",
" at Module.require (internal/modules/cjs/loader.js:887:19)",
" at require (internal/modules/cjs/helpers.js:74:18)",
" at /var/task/__index.js:51:44",
" at Runtime.__f0 [as handler] (/var/task/__index.js:114:6)"
]
}

Doing some research on this error, it lead me to believe there is something wrong with the Lambda function created by the query (testing it on the lambda console also gives the error), but i cannot figure out what exactly. I have attached the function zip file for reference.
Any help regarding this would be appreciated. Thank you!

[mapboxQuery4c238266-4f5effe-d1205eea-5cad-4a4e-bf08-5c48634bfdc0.zip](https://github.com/mapbox/asset-tracking/files/7331897/mapboxQuery4c238266-4f5effe-d1205eea-5cad-4a4e-bf08-5c48634bfdc0.zip)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CloudWatch error and the attached Lambda function ZIP, then reproduce the failure in the Lambda console. Trace the query-generated function's import of @turf/helpers and verify the deployed package resolution. Done means the API endpoint no longer returns an internal server error and the Lambda invocation completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
api, backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.