-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Can't resolve 'source-map-support/register' in 'libs/response-lib.js' #45
Comments
Do you have a repo I can reproduce this with? Or if I can get the |
package.json
|
lambda code import requestlib from "request-promise";
import { success, failure } from "../libs/response-lib";
export async function main(event, context) {
const data = JSON.parse(event.body);
const options = {
method: "POST",
uri: `https://api.trello.com/1/cards`,
form: {
name: data.name,
idList: data.idList,
idLabels: data.idLabel,
pos: data.position,
key: process.env.API_KEY,
token: process.env.SECRET
}
};
try {
let result = await requestlib(options);
return success(result);
} catch (e) {
console.log(e);
return failure({ status: false });
}
} |
Thanks for that. I'll give this a try and let you know. |
Hmm I gave it a try and couldn't repro it. But I used the Maybe yours is different? Can you post that here? And your Also just to make sure, did you delete your |
I did delete my my export function success(body) {
return buildResponse(200, body);
}
export function failure(body) {
return buildResponse(500, body);
}
function buildResponse(statusCode, body) {
return {
statusCode: statusCode,
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
},
body: JSON.stringify(body)
};
} Here is
|
@jayair is there anything else I can provide to help with this? |
@chrisanderss0n Are the paths correct here? In your import { success, failure } from "../libs/response-lib"; But your import { success, failure } from "./libs/response-lib"; |
@jayair if you could provide me with a place to begin looking I can see if I can figure this out and submit a PR. |
@chrisanderss0n I had tried your setup and got it to work with The best way to check this would be to create a simple repo that replicates the error. Would that be possible? |
@jayair I'm facing the same problem :( @chrisanderss0n have you figured this out? Below is my folder structure. My serverless project is the user folder. One level above (outside the user project) I've got the lib folder with some code I'd like to share with my serverless projects.
This is how my handler is importing the code. import { failure, success } from "../../lib/responses";
export const main = async (event, context) => {
//code.... |
@vinyoliver I know in @chrisanderss0n's case I found the path was set incorrectly. I'm not sure what the issue is for your case. Can you make a repo or post the steps to recreate it? |
@jayair sorry for the late response. I got back to this issue today. I've created a new repo using the same structure as my project. I still get the same error; Maybe I'm missing something Repo Example: https://github.com/vinyoliver/error-serverless Lambda location: https://github.com/vinyoliver/error-serverless/tree/master/api/person/services Tks in advance! |
I've finally figured out! After comparing my project to this project example I've noticed the only difference between them was that my root package.json was missing the serverless-bundle dependency. After adding serverless-bundle dependency into my root package.json everything worked as expected! I guess would be helpful to mention this on the README. The project example I got from this post: |
Ah I see. Thanks for pointing it out. |
As @vinyoliver mentioned, the solution is to install serverless as a dev dependency into your project |
Following the instructions to upgrade to
serverless-bundle
I get the following error when trying to deploy withserverless deploy
The text was updated successfully, but these errors were encountered: