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
package main
import (
"fmt"
"log"
"net/http"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sns"
)
// Simulate an SNS subscriber for testing
func startSNSSubscriber() {
sess, err := session.NewSession(&aws.Config{
Region: aws.String("us-east-2"),
})
if err != nil {
log.Fatalf("Failed to create AWS session: %v", err)
}
svc := sns.New(sess)
http.HandleFunc("/sns-subscriber", func(w http.ResponseWriter, r *http.Request) {
// Simulate receiving a message from SNS (in practice, use SQS or HTTP endpoint)
log.Println("Received message from SNS topic")
fmt.Fprintf(w, "Message received")
})
go func() {
// Subscribe to the SNS topic (manual step for this example; typically done via AWS console or CLI)
log.Println("Subscriber listening on :8081...")
http.ListenAndServe(":8081", nil)
}()
}
func main() {
// Start SNS subscriber simulation
startSNSSubscriber()
// Simulate KrakenD frontend for testing
http.HandleFunc("/v1/event", func(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
log.Println("Received POST to /v1/event, forwarding to SNS...")
// KrakenD would handle SNS publishing here based on krakend.json
fmt.Fprintf(w, `{"status": "Message sent to SNS"}`)
})
log.Println("Starting KrakenD simulation on :8080...")
err := http.ListenAndServe(":8080", nil)
if err != nil {
log.Fatalf("Server failed: %v", err)
}
}
Environment info:
krakend help | grep Version
and copy the output hereuname -srm
or writedocker
when using containersDescribe the bug
The KrakenD documentation for AWS SNS incorrectly identifies the service as a subscriber instead of a publisher.
Your configuration file:
{
"$schema": "https://www.krakend.io/schema/krakend.json",
"version": 3,
"name": "KrakenD - API Gateway",
"timeout": "3000ms",
"cache_ttl": "300s",
"endpoints": [
{
"endpoint": "/v1/event",
"method": "POST",
"output_encoding": "json",
"backend": [
{
"host": [
"awssns:///arn:aws:sns:us-east-2:123456789012:mytopic"
],
"disable_host_sanitize": true,
"url_pattern": "/",
"extra_config": {
"backend/pubsub/susbcriber": {
"subscription_url": "?region=us-east-2"
}
}
}
]
}
]
}
Commands used
How did you start the software?
Expected behavior
The documentation should correctly reflect that AWS SNS is being used as a publisher when sending information.
Logs
If applicable, any logs you saw in the console and debugging information
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: