Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

bad argument #1 to 'clear_tab' (table expected, got nil) #24

Open
ctessier opened this issue Dec 1, 2017 · 1 comment
Open

bad argument #1 to 'clear_tab' (table expected, got nil) #24

ctessier opened this issue Dec 1, 2017 · 1 comment

Comments

@ctessier
Copy link

ctessier commented Dec 1, 2017

Hi,

I am getting the following error when trying to set a new cookie:
failed to run body_filter_by_lua*: /usr/local/share/lua/5.1/resty/cookie.lua:164: bad argument #1 to 'clear_tab' (table expected, got nil)

My code:

return cookie:set({
        key = "Name",
        value = "Bob",
        path = "/",
        domain = "domain.com",
        secure = false, httponly = true,
        expires = "Wed, 09 Jun 2021 10:18:14 GMT",
        max_age = 50,
        samesite = "Strict",
        extension = "a4334aebaec"
    })

Thank you for your help

@miguel-martinez-tfs
Copy link

miguel-martinez-tfs commented Sep 1, 2020

Very late, but to anyone else who ran into this problem (like me), the solution is to initialize an instance first, like so:

local ck = require "resty.cookie"
local cookie, err = ck:new()
return cookie:set({
...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants