Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 16 2019 18:39

    carlosandrebp on master

    upload email icon (compare)

  • Jan 15 2019 14:03

    carlosandrebp on master

    Icons update (compare)

  • Nov 13 2018 16:54
    hassankhan commented #3
  • Nov 02 2018 15:10
    hassankhan commented #3
  • Nov 02 2018 15:10
    hassankhan commented #3
  • Nov 01 2018 23:19
    hassankhan commented #3
  • Oct 29 2018 16:32
    hassankhan commented #3
  • Oct 24 2018 14:38
    hassankhan opened #3
  • Aug 14 2018 23:50

    carlosandrebp on master

    updates animations (compare)

  • Jul 19 2018 16:34
    brianneisler closed #1
  • Jul 19 2018 16:34
    brianneisler commented #1
  • Jul 18 2018 16:36

    andrepiresbp on master

    Updates (compare)

  • Jul 18 2018 15:50

    andrepiresbp on master

    Update (compare)

  • Jul 09 2018 19:25
    gornostal commented #59
  • Jul 09 2018 19:12
    maheshmasale commented #59
  • May 24 2018 23:39
    DavidWells removed as member
  • Feb 13 2018 19:40
    ivan-myob commented #54
  • Feb 08 2018 08:48
    julien2x opened #62
  • Dec 22 2017 16:14
    awcheng opened #61
  • Oct 23 2017 19:12
    dluu2015 closed #60
Gareth McCumskey
@garethmcc
and provider.stage will alway be thatr because that is the config value. opt.stage would be what is passed
Ross Coundon
@rcoundon
I'll investigate, I can see that in sls.config I can get hold of cliInputArgv: [ '--s', 'production', 'deploy' ], so could parse that out but I suspect the parsed command line must be in there somewhere. It's not possible to stringify the object due to lots of circular dependencies so I'll do some digging and report back. Thanks for the pointers
Ross Coundon
@rcoundon
Hmm, printing out all of the contents of the serverless object using flatted and the term production only occurs in terms of the command line arguments. There's no opt or options property in there anywhere
Ross Coundon
@rcoundon
Maybe there's a different object I need to get hold of?
Ross Coundon
@rcoundon

So, looking through source code of serverless led me to the processedInput variable.
Doing this

const serverless = require('serverless');

const sls = new serverless();
sls.init();
console.log(JSON.stringify(sls.processedInput, null, 2));

Produces

{
  "commands": [
    "offline",
    "start"
  ],
  "options": {
    "stage": "production"
  }
}

processedInput isn't marked as private so I guess this is 'safe'...

Ross Coundon
@rcoundon
Although, as it's JS and #/private proposal is at stage 3, I guess it could happen later
Ross Coundon
@rcoundon
So any other ideas, greatly appreciated (sorry to spam the channel!)
jugglingjsons
@jugglingjsons

Hey! Is there a way to keep deletionPolicy on an s3 bucket and dynamodb table and use the same buckets / s3 from old deployments on new stacks?
I want to use the same serverless.yml to deploy new stacks and redeploy stack using the previously retained s3 buckets / dynamodb tables.
I've set up the:

DeletionPolicy: Retain
but currently getting
An error occurred: xxxx - xx-xx-xx-xx already exists.
on redeployments

Vaidas Unchained
@codepreneur
does anyone know how I can add "Accept": "image/png" header to every single request that comes in through api gateway to my lambda?
Ross Coundon
@rcoundon
I'm not sure but as the lambda is handling an event and you want to do it for all requests, why can't it assume the header is there? Is the lambda being used for other event sources?
Abhinav Prakash
@abhinavsp0730
Hi @all. I'm very new to serverless. I've
tried to deploy my first express server to aws with serverless but I'm getting 502 gateway error. Would you Folks please help me🥺.
'''
Abhinav Prakash
@abhinavsp0730
Below is my app.js code

const serverless = require('serverless-http');
const express = require("express");
const qs = require("qs");
const bodyParser = require("body-parser");
const axios = require("axios");

const app = express();

//app.use(
//cors({
//origin: "https://xxx",
//})
//);
//
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(bodyParser.text());
app.use(bodyParser.raw());

// let corsOptions = {
// origin: "https://xxx",
// // allowedHeaders: [
// // "Content-Type",
// // "Authorization",
// // "Content-Length",
// // "X-Requested-With",
// // "Accept",
// // ],
// methods: ["GET", "PUT", "POST", "DELETE", "OPTIONS"],
// optionsSuccessStatus: 200, // some legacy browsers (IE11, various SmartTVs) choke on 204
// };

// // app.use(cors(corsOptions));

// const corsm = (req, res, next) => {
// res.header("Access-Control-Allow-Origin", "*");
// res.header("Access-Control-Allow-Methods", "GET, POST");
// res.header(
// "Access-Control-Allow-Headers",
// "Origin, X-Requested-With, Content-Type, Accept, Authorization"
// );
// next();
// };

// app.use(function (req, res, next) {
// res.setHeader(
// "Access-Control-Allow-Origin",
// "xxx"
// ); // update to match the domain you will make the request from
// res.setHeader(
// "Access-Control-Allow-Headers",
// "Origin, X-Requested-With, Content-Type, Accept"
// );
// next();
// });

// app.options(function (req, res, next) {
// res.setHeader(
// "Access-Control-Allow-Origin",
// "xxxx"
// ); // update to match the domain you will make the request from
// res.setHeader(
// "Access-Control-Allow-Headers",
// "Origin, X-Requested-With, Content-Type, Accept"
// );
// next();
// });

app.post("/punctuate", async (req, res) => {
console.log("called");
let { text } = req.body;

text = text.replace(/\b((Applause)|(Laughter)|(thank you))\b/g, match => "");

text = text.replace(/[()|`|-|``|'']/g, "");

text = text.replace(/\s+/g, " ").trim();
try {
    const data = await axios({
        method: "post",
        url: "https://xxxx",
        data: qs.stringify({ text }),
        headers: {
            "content-type": "application/x-www-form-urlencoded;charset=utf-8",
            "Access-Control-Allow-Origin": "*",
        },
    });

    res.status(200).json({ text: JSON.stringify(data.data) });
} catch (error) {
    console.log(error.response);
    res.json({ text: "" });
}

});

app.post("/summary", async (req, res) => {
let talk = req.body;

const result = await axios({
    url: "https://xxxx",
    method: "post",
    headers: {
        "Content-Type": "text/plain",
    },
    data: talk,
});

res.status(200).send(result.data.summary);

});

// app.listen(8080, () => {
// console.log("server started 🚀,port 8080");
// });
module.exports.handler = serverless(app);

Ross Coundon
@rcoundon

Below is my app.js code

Hi - it's really hard to follow that as it's not formatted properly and there's lots that's commented out. It might be more readable if you set it up as a gist or codepen, or similar and link to it so we can help

Abhinav Prakash
@abhinavsp0730
@rcoundon Thanks ross. It's working now . But I'm able to do a post request using a curl command. But when I'm testing the API with fetch I'm getting cors error(CORS Missing Allow origin). But I haven't enabled cors while deploying in Aws Api gateway and in aws lamba also?
Chester O'Neill
@ThrowsException
Ive been looking into ways to bundle a serverless node application. I see serverless-webpack has the option for includeModules but is there a reason that you wouldn't just want webpack to bundle/treeshake everything for you and just output a single file?
epanfile
@epanfile
anyone know of instructions on how to debug the serverless framework code? more specifically, I am interested in extending the amplify-appsync-simulator plugin. How can I debug the code I am writing in this plugin?
Himanshu Joshi
@himharsh1997
Error: Body must be a string. Received: undefined.
getting this error on doing setup of aws appsync in serverless
Ross Coundon
@rcoundon

@rcoundon Thanks ross. It's working now . But I'm able to do a post request using a curl command. But when I'm testing the API with fetch I'm getting cors error(CORS Missing Allow origin). But I haven't enabled cors while deploying in Aws Api gateway and in aws lamba also?

Hi - you can specify cors on the http event:

    events:
      - http:
          path: somepath
          method: post
          cors: true

But you also need to return the necessary CORS headers from your lambda function.
For example, you could define a function to add the necessary headers to your returned objects something like

export function addCorsHeaders(response: APIGatewayProxyResult): APIGatewayProxyResult {
  if (!response.headers) {
    response.headers = {};
  }
  response.headers['Access-Control-Allow-Headers'] = 'Content-Type';
  response.headers['Access-Control-Allow-Origin'] = '*';
  response.headers['Access-Control-Allow-Methods'] = 'OPTIONS,POST,GET,PATCH,PUT,DELETE';

  return response;
}

Then you'd use it like:

const response = {
        statusCode: 200,
        body: JSON.stringify({
          message: 'some data',
        }),
      };
return addCorsHeaders(response);
Ross Coundon
@rcoundon

Ive been looking into ways to bundle a serverless node application. I see serverless-webpack has the option for includeModules but is there a reason that you wouldn't just want webpack to bundle/treeshake everything for you and just output a single file?

includeModules just gives you some options around including/excluding certain packages. For example, you might use something that is OS specific like sharp for local testing but not want this bundled in the package, so you can then use includeModules/forceExclude with sharp. Also, if you wanted to be specific about what to include you can use forceInclude, maybe you might want to do that with aws-sdk rather than use the version that lambda containers automatically include

ค๓เՇ
@amitizle_twitter

Hello, can someone please advise if the following makes sense?

functions:
  myCloudWatch:
    handler: myCloudWatch.handler
    events:
      - cloudwatchEvent:
          event:
            arn: "arn:aws:events:us-east-1:123456789012:rule/MyScheduledRule"
            source:
              - 'aws.events'
            detail-type:
              - 'Scheduled Event'

Generally I want to grant the λ function with a permission to be invoked by some scheduled rules, which are dynamic and therefore cannot be defined in the configuration yaml.
Thanks

nbouliol
@nbouliol
Hello, does anyone have a working example of deploying a lambda in a vpc to have a static ip ?
clmn
@JacksonGariety
I put cors: true in the function config in my serverless.yaml, but the browser still complains that the response to the preflight request "does not have HTTP ok status."
clmn
@JacksonGariety
I tried sending an OPTIONS request with curl and I got "internal server error"
Gareth McCumskey
@garethmcc
@JacksonGariety Can you share your serverless.yml config?
John Mikel Regida
@johnmikel
Hi guys, I'm trying to deploy nextjs in serverless using the plugin and I am getting a weird error - ReferenceError: window is not defined. Does anyone know where to start in solving this?
John Mikel Regida
@johnmikel
solved this using nextjs' dynamic imports
Yusuf Kanchwala
@kanchwala-yusuf
Hi Guys,
Can anyone please let me know if Azure Event Grid is supported as an event source in the serverless framework?
Manpreet Singh
@manpoffc
Hi Guys, I'm new here. Looking forward to contributing.
Alexandre Lemaire
@Saeven
Hey guys! Quick new-to-this question for you. Am using serverless through bref.sh; serverless deploy is failing with s3:CreateBucket Access Denied; can I specify the bucket that gets used somehow, such that the bucket can be created beforehand? For policy reasons (we work in a highly regulated industry), we can't allow auto-creation in access keys that are available to devs.
Kevin Piazzoli Felix Perez
@kevin4dhd
Hello guys, I hope you have a good day, my question is the following, as I create more tables with the aws-dynamodb component, if someone could give me the answer I would be very grateful, I have been stuck for several days.
Aws-dynamodb link: https://github.com/serverless-components/aws-dynamodb
Ross Coundon
@rcoundon
@JacksonGariety you need to return the necessary headers from your lambda too
r_mohan
@r_mohan_twitter
How versatile is the VTL in the gateway ? Can I populate a error JSON and return 400 when validation fails ? It should all happen within the VTL.
Tyler Compton
@velovix
Hi everyone. I'm trying to write a plugin that operates on AWS resources after they're created, but I'm not sure how to get the IDs or ARNs of these resources. If I pass !Ref MyResourceto my plugin, I just get a simple object: {Ref: MyResource} instead of the result of the function. If I look up the resource by name in serverless.service.resources.Resources[], I get all the information I provided in the CloudFront template, but not the ID or ARN.
pradeepkusingh
@pradeepkusingh
Team, I am trying to implement canary deployment using serverless framework, do we have any sample to follow?
Gareth McCumskey
@garethmcc
@pradeepkusingh I believe this is what you need: https://www.youtube.com/watch?v=umsaXWrpgR8
pradeepkusingh
@pradeepkusingh
thanks @garethmcc
not interested in politics :)
Alex Metzger
@ametzger
anyone got a sec for a funky problem? I'm trying to run a Python lambda but it seems like whenever I run sls deploy the package is getting uploaded with my python files present but truncated
Alex Metzger
@ametzger
looks like it might be darwin-specific, I'm just using a docker container and everything seems happy
MeetupFeed
@MeetupFeedio_twitter
Hey guys, we've created a selection of 2020's most relevant Serverless-related meetup videos, covering a bunch of hot topics, including the present and future of Serverless, migrating existing applications to Serverless, building brand new ones from scratch, and how Serverless can improve a team's productivity. You can read it here: https://blog.meetupfeed.io/serverless-meetup-videos-2020/
Felipe Campelo
@fccampelo
Can anyone tell me if the lambda's memory consumption is shared with its intentions?
juandans01
@juandans01
Hi! so i'm having a really weird issue, the serverless cli it's not working, at all, the only command that works is help, all the other things get stalled, maybe something is down ? i'm really confused of what's happening, any help is appreciated
Ghost
@ghost~60111b45d73408ce4ff9d7c6
Hi Everyone
Can anyone suggest best document / website for converting php monolithic app to Cloud Agnostic App? we are using AWS Cloud.
Praneet Rattan
@praneetrattan
Hello! I anyone else having issues recving slack alert notifications in case of invocation failures? We have had our setup for the past year, and after Jan 26th we haven't recvd any alerts. I added a new notification channel but yet no avail!
Any help would be appreciated.
catastrophicsoftware
@catastrophicsoftware
image.png
Shouldn't there be arm templates in the template store? I cannot for the life of me find any arm templates. But I am seeing that they should exist