You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm using serverless-localstack, I can get a regular handler to work and I can invoke the function that utilizes serverless-mysql but if I try to access the function's path via the browser, the page hangs, I get no results, usually I'm redirected back to the previous path, and I can see a lambda instance spin up in docker and just stay running.
I'd expect that if I can invoke the function that I'd get the results and the page wouldn't hang. I tried using massive for connecting to PostgreSQL and it worked but I thought this would be closer to what I'm used to and work better in the serverless ecosystem.
const mysql = require('serverless-mysql')({
config: {
host : process.env.MYSQL_ENDPOINT,
database : process.env.MYSQL_DATABASE,
user : process.env.MYSQL_USER,
password : process.env.MYSQL_PASSWORD
},
onError: (error) => { // This is never called, did I code this correctly?
return {
statusCode: 500,
body: error
}
}
})
exports.hello = async (event) => { // This works
const { name = '' } = event.body || {}
return {
statusCode: 200,
body: `Hello ${name} 👋`,
}
}
exports.testdb = async () => { // This hangs and creates a lambda docker that does nothing
let results = await mysql.query('SELECT * FROM test')
await mysql.end() // If I use mysql.quit(), the invoke call will finish, I still get the same error on the page though
return results
}
If I run invoke, I'll get the following and no lambda instance in docker:
Which is all correct data. If I use await mysql.quit() instead of .end(), it'll give me back my terminal, but with .end(), it just hangs there until I ctrl+c out of it.
Is this related to #79? Is there a way to implement this with serverless-localstack for local development and testing?
The text was updated successfully, but these errors were encountered:
When I'm using
serverless-localstack
, I can get a regular handler to work and I can invoke the function that utilizesserverless-mysql
but if I try to access the function's path via the browser, the page hangs, I get no results, usually I'm redirected back to the previous path, and I can see a lambda instance spin up in docker and just stay running.I'd expect that if I can invoke the function that I'd get the results and the page wouldn't hang. I tried using
massive
for connecting to PostgreSQL and it worked but I thought this would be closer to what I'm used to and work better in the serverless ecosystem.Here is my serverless.yml:
Here's my handler.js:
If I run invoke, I'll get the following and no lambda instance in docker:
Which is all correct data. If I use
await mysql.quit()
instead of.end()
, it'll give me back my terminal, but with.end()
, it just hangs there until Ictrl+c
out of it.Is this related to #79? Is there a way to implement this with
serverless-localstack
for local development and testing?The text was updated successfully, but these errors were encountered: