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
Maarten van der Hoef
@maartenvanderhoef
Hi! Appsync & CORS, I cannot find any resources on this topic, has anyone battled this before ?
Etienne de Bruin
@everydev_gitlab
Hi everyone, I would love some help on configuring serverless to work with Lex. Any pointers on serverless.yml should be configured to make this work?
Timo Klok
@timoklok

Hi all,

I’ve an issue with the settings in the serverless dashboard. I recently joined an organisation which had 4 existing apps, all of them have 2 stages and some have extra parameters. I’ve added a 5th app and wanted to add a few parameters. But when I open the ‘settings’ of any app, the stages section is empty (it only shows the ‘default’ stage), and when I click on the default stage, it always shows the parameters that belong to one specific app, regardless of which app I’m currently watching. And when I add a new parameter, it will show up in the settings of all apps. So to me it seems like there’s an issue with the dashboard interface itself.

Anyone who has the same issue? And / or a solution? Thanks!

Gareth McCumskey
@garethmcc
@timoklok Replied to you on Dashboard support
Adam Nalisnick
@theadam
Hey everyone, I seem to be having a problem using aws + java runtime + invoke local + custom config location
If I run sls invoke local --config serverless-project.yml -f myFunction, the result is this:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.HashMap

        at com.serverless.InvokeBridge.getContext(InvokeBridge.java:54)
        at com.serverless.InvokeBridge.<init>(InvokeBridge.java:38)
        at com.serverless.InvokeBridge.main(InvokeBridge.java:137)
I have tracked the issue a bit, apparently in lib/plugins/aws/invokeLocal/index.js:invokeLocalJava the customContext variable is set to the name of the config file. When the string is passed to the InvokeBridge it cannot be case to a hash map
any ideas for how to fix this?
Irshad A Buchh
@ibuchh
Can some one share a working example of serverless with AWS Lambda Container Support using either a Dockerfile or Docker registry?
Gareth McCumskey
@garethmcc
@ibuchh This should help you out; I published this last week: https://www.serverless.com/blog/container-support-for-lambda/
Irshad A Buchh
@ibuchh
@garethmcc I have seen that post, but I needed specific example using a Dockerfile instead. Also I want to use CMD, ENTRYPOINT flags as well as mentioned on the AWS docs here: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html
Karim Awd
@karim-awd
I'm using serverless.ts and using Fn::ImportValue to load into environment a bucket name that's outputted from another stack but Fn::ImportValue doesn't work and the environment variable has string "Fn::ImportValue: ...." instead of resolving it
Gareth McCumskey
@garethmcc
@ibuchh Currently those features have not yet been added to the framework
Imran
@Imran99
Hey guys i've been using https://www.npmjs.com/package/serverless-pseudo-parameters to resolve AWS::AccountId but thats deprecated as apparently this is now supported in serverless framework directly. I can't seem to get this to work though and the documentation https://www.serverless.com/framework/docs/providers/aws/guide/variables#pseudo-parameters-reference only mentions using pseudo parameters in the resources section which is not the same as what the plugin offered. Any ideas if it is actually possible to now reference AWS::AccountId from anywhere in serverless.yml?
Ross Coundon
@rcoundon
Is there any way to access serverless CLI options like stage in serverless.ts ? Would be cool to apply some logic driven by things like stage and region #Serverless #typescript
Gareth McCumskey
@garethmcc
@rcoundon They should still be available as variables using ${} syntax.
Ross Coundon
@rcoundon

@rcoundon They should still be available as variables using ${} syntax.

They can be referenced inside the configuration using the likes of

stage: '${opt:stage, self:provider.stage}',

But what I'd like to do is to reference them outside of the configuration e.g.

import type { AWS } from '@serverless/typescript';
console.log('${opt:stage, self:provider.stage}');

const serverlessConfiguration: AWS = {
...
  provider: {
    name: 'aws',
    stage: 'dev',
    stackTags: {
      stage: '${opt:stage, self:provider.stage}',
    }
}
i.e. the console.log() of the stage
Gareth McCumskey
@garethmcc
Dont wrap them in ' ?
Try console.log(${opt}) and see what you get?
Ross Coundon
@rcoundon

Dont wrap them in ' ?

TypeScript won't compile then as there's no variable in scope with that name and even in JavaScript it becomes invalid syntax - i.e.

console.log(`${opt:stage}`); // can't have a colon in a variable name
Gareth McCumskey
@garethmcc
Try just opt to see what it has if anything. I am pretty sure the framework makes them aqvailable in the serverless.ts I just can't recall exactly how
Ross Coundon
@rcoundon
Yeah, unfortunately can't compile the TS with that, and using JS just throws the error:
ReferenceError: opt is not defined
Ross Coundon
@rcoundon
After some playing around, it looks like it can be done by importing the serverless instance itself:
const serverless = require('serverless');  // Haven't worked out why I can't use import here yet
const sls = new serverless();
console.log(sls.service.provider.stage); // prints 'dev'
Ross Coundon
@rcoundon
As a result of running
sls offline --s dev start
Ross Coundon
@rcoundon
I take that back, it always prints dev ...
Gareth McCumskey
@garethmcc
Can you use --stage instead?
dev is the default
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);