Git Product home page Git Product logo

cloud-docs's Introduction

deta

this is deta

cloud-docs's People

Contributors

aavshr avatar abdelhai avatar betahuhn avatar blmayer avatar dependabot[bot] avatar dhs avatar harshitsinghai77 avatar ilsubyeega avatar jimtyhurst avatar lakuapik avatar lcarbonaro avatar lemonyte avatar mnaray avatar mweyaruider avatar nikahmadz avatar ninja243 avatar posandu avatar rabingaire avatar rohanshiva avatar sadikkuzu avatar shrihari689 avatar sreeram-venkitesh avatar tbdsux avatar tducret avatar timbusfield avatar tomdyson avatar waptik avatar weensy avatar xeust avatar zykkl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cloud-docs's Issues

Split 'Advanced Usage' doc into separate docs

The Micros docs can have three separate pages, replacing the 'advanced usage' page:

  • API Keys
  • Visor
  • Technical Details

Each page could have a detailed doc / tutorial with context as to 'why' each piece is useful.

Nodemailer not working on production [Micro]

I created a micro for dispatch emails (expressjs), I added all the npm packages including nodemailer which is the common library for this purpose. On my local is work fine but when I deployed it, I updating the .env vars, the request is called from https://xxxxx.deta.dev but the email never was send. Exist some limit for mailing? micros are limited to return or send data only?

Issue In Form Endpoints Section

Hello sir, firstly thankyou so much for Deta

I am a newbie to Deta, and thought to start with Form Endpoints. I executed all the commands successfully till npm install express, but got an error while executing deta new command. Here are the commands that I executed sequentially:

mkdir express-form
cd express-form
npm install express
deta new

But got the following message while trying to execute deta new command

No entrypoint file found in 'D:\VS Code Workspace\Rough Space\express-form'. Please, provide a name or path to create a new micro elsewhere. See deta new --help.'

Let me also attach screenshots so that you could understand my issue better

image

I know I might be making some silly mistake or something, but can't understand why even though I am following all the steps you mentioned sequentially, I am not getting the desired output.

In case you require information of my system, then here is it:

OS Name	Microsoft Windows 11 Home Single Language
Version	10.0.22000 Build 22000
Other OS Description 	Not Available
OS Manufacturer	Microsoft Corporation
System Name	SAMS-LAPTOP
System Manufacturer	HP
System Model	HP Pavilion Laptop 15-eg0xxx
System Type	x64-based PC
System SKU	2N1K7PA#ACJ
Processor	11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz, 2419 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date	Insyde F.12, 17-03-2021
SMBIOS Version	3.3
Embedded Controller Version	34.27
BIOS Mode	UEFI
BaseBoard Manufacturer	HP
BaseBoard Product	8850
BaseBoard Version	34.27
Platform Role	Mobile
Secure Boot State	On
PCR7 Configuration	Elevation Required to View
Windows Directory	C:\WINDOWS
System Directory	C:\WINDOWS\system32
Boot Device	\Device\HarddiskVolume1
Locale	United States
Hardware Abstraction Layer	Version = "10.0.22000.1"
User Name	SAMS-LAPTOP\Hp
Time Zone	India Standard Time
Installed Physical Memory (RAM)	16.0 GB
Total Physical Memory	15.8 GB
Available Physical Memory	6.89 GB
Total Virtual Memory	18.1 GB
Available Virtual Memory	3.93 GB
Page File Space	2.38 GB
Page File	C:\pagefile.sys
Kernel DMA Protection	On
Virtualization-based security	Running
Virtualization-based security Required Security Properties	
Virtualization-based security Available Security Properties	Base Virtualization Support, Secure Boot, DMA Protection, SMM Security Mitigations 1.0, Mode Based Execution Control, APIC Virtualization
Virtualization-based security Services Configured	
Virtualization-based security Services Running	
Device Encryption Support	Elevation Required to View
A hypervisor has been detected. Features required for Hyper-V will not be displayed.	

Could you kindly help me to get started with Deta

ThankYou
Sam Varghese

Error: failed to update dependencies: Internal server error

My requirements.txt file includes tensorflow package. Once I take this requirement out the build works properly. Does deta not support tensorflow..

Deploying...
Successfully deployed changes
Updating dependencies...
Error: failed to update dependencies: Internal server error

Please let me know how I can resolve this or deta has some restrictions in requirements that we can include.

Japanese cannot be processed when using flask

Discussed in https://github.com/orgs/deta/discussions/477

Originally posted by mochidukiyukimi September 14, 2022
"UnicodeEncodeError" occurs when trying to process a Japanese query.
Probably a wsgi error.
Traceback (most recent call last):   File "/opt/python/detalib/debugger.py", line 131, in wrap     return func(event, context)   File "/var/task/_entry.py", line 14, in handler     return handle(event, main)   File "/opt/python/detalib/handler.py", line 32, in handle     return handlers.handle_bare_wsgi(event, main, context)   File "/opt/python/detalib/handlers.py", line 32, in handle_bare_wsgi     return resolve(main.app, event)   File "/opt/python/detalib/adapters/wsgi/__init__.py", line 149, in resolve     result = app(get_environ(event), response.start_response)   File "/opt/python/flask/app.py", line 2548, in __call__     return self.wsgi_app(environ, start_response)   File "/opt/python/flask/app.py", line 2520, in wsgi_app     ctx = self.request_context(environ)   File "/opt/python/flask/app.py", line 2437, in request_context     return RequestContext(self, environ)   File "/opt/python/flask/ctx.py", line 309, in __init__     request = app.request_class(environ)   File "/opt/python/werkzeug/wrappers/request.py", line 115, in __init__     query_string=environ.get("QUERY_STRING", "").encode("latin1"), [2022-09-14T20:16:19+09:00] [ERROR] UnicodeEncodeError: 'latin-1' codec can't encode characters in position 2-4: ordinal not in range(256)

Cannot Run Node JS Anymore!

Discussed in https://github.com/orgs/deta/discussions/645

Originally posted by sancho1952007 December 13, 2022
My Python Code Works Fine But The Node Doesn't Work At All!
Error:

Error: Unsupported framework
    at getFramework (/opt/nodejs/node_modules/serverless-http/lib/framework/get-framework.js:63:9)
    at module.exports (/opt/nodejs/node_modules/serverless-http/serverless-http.js:14:21)
    at Object.handleCustom (/opt/nodejs/node_modules/detalib/deta/internal/handlers.js:20:19)
    at handler (/opt/nodejs/node_modules/detalib/deta/lib/handler.js:13:46)
    at Object.handler (/opt/nodejs/node_modules/detalib/deta/internal/debug/debugger.js:170:30)
    at Runtime.module.exports.handler (/var/task/_entry.js:11:18)
    at Runtime.handleOnceNonStreaming (/var/runtime/Runtime.js:74:25)

An existing connection was forcibly closed by the remote host

I get this error periodically in some of my apps. Is it a Deta issue or an issue with my server? Not sure. Any idea what the cause could be?

2022-11-13 12:03:24,056 - root - ERROR - Traceback (most recent call last):
File "C:\Users\Ryan\PycharmProjects\smartbids\scripts\generate_all_data.py", line 45, in
save_file_to_cloud_pickle(X, 'engineeredX.pickle')
File "C:\Users\Ryan\PycharmProjects\smartbids\ml\utils.py", line 78, in save_file_to_cloud_pickle
drive.put(file_name, pickled_data)
File "C:\Users\Ryan\anaconda3\lib\site-packages\deta\drive.py", line 195, in put
raise e
File "C:\Users\Ryan\anaconda3\lib\site-packages\deta\drive.py", line 188, in put
self._upload_part(name, chunk, upload_id, part, content_type)
File "C:\Users\Ryan\anaconda3\lib\site-packages\deta\drive.py", line 137, in _upload_part
self._request(
File "C:\Users\Ryan\anaconda3\lib\site-packages\deta\service.py", line 74, in _request
res = self._send_request_with_retry(method, url, headers, body)
File "C:\Users\Ryan\anaconda3\lib\site-packages\deta\service.py", line 114, in _send_request_with_retry
self.client.request(
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 1279, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 1325, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 1274, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 1034, in _send_output
self.send(msg)
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 974, in send
self.connect()
File "C:\Users\Ryan\anaconda3\lib\http\client.py", line 1448, in connect
self.sock = self._context.wrap_socket(self.sock,
File "C:\Users\Ryan\anaconda3\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\Ryan\anaconda3\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\Ryan\anaconda3\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

Add "New micro under project" section in getting started.

I wanted to init a micro under the project last night and got a little turned around trying to find the answer and ended up having to leverage the slack channel. In my opinion, this is a common use case and the developer experience would benefit from the small addition in the mirco getting started section of something along the line of:

Add Micro To Specific Project

deta new --project <your-project> 

Related Issue

Issue 42 in cli

Unknown Error while Deploying

Hey!

I was checking out this website and trying to run my Flask API on it. I am running it on repl.it as of now, but your service fascinates me tbh. Anyways, well it was starting without any error(s) on repl.it and on my local laptop. But while deploying, I am getting this error again and again.

Running micro...

Response:
{
        "errorMessage": "'path'",
        "errorType": "KeyError",
        "stackTrace": [
                "  File \"/opt/python/detalib/debugger.py\", line 154, in wrap\n    raise e\n",
                "  File \"/opt/python/detalib/debugger.py\", line 142, in wrap\n    result = func(event, context)\n",
                "  File \"/var/task/_entry.py\", line 14, in handler\n    return handle(event, main)\n",
                "  File \"/opt/python/detalib/handler.py\", line 32, in handle\n    return handlers.handle_bare_wsgi(event, main, context)\n",
                "  File \"/opt/python/detalib/handlers.py\", line 32, in handle_bare_wsgi\n    return resolve(main.app, event)\n",
                "  File \"/opt/python/detalib/adapters/wsgi/__init__.py\", line 149, in resolve\n    result = app(get_environ(event), response.start_response)\n",
                "  File \"/opt/python/detalib/adapters/wsgi/__init__.py\", line 22, in get_environ\n    \"PATH_INFO\": event[\"path\"],\n"
        ]
}

I have listed both of my dependencies in the requirements.txt (python-aiml and flask) and, if this is important, I don't use deta library in my code. Help would be appreciated!

Thanks!

Python 3.9 runtime is not supported

I have changed the .deta/prog_info file python runtime version to 3.9
image
but when I use deta pull it says runtime not supported
image

I need to use that runtime for my FastAPI micro app.

bug: the query section is not available

I'm working on a version of your HTTP API in the Dart language, but I can't access the URL because the hyperlink is not available.

Deta seems to me to be a magnificent project with a splendid future. I would like, if possible, to make this version of the dart library available to the community. This is the repository.

"Bad Gateway" error

Hi, ther:

I am pretty new in fastai and deta.

I follow the tutorial code, and deploy micro successfully.

"from fastapi import FastAPI, File, UploadFile
from fastapi.responses import HTMLResponse, StreamingResponse
from deta import Deta

app = FastAPI()
deta = Deta() # configure your Deta project
drive = deta.Drive("photos") # access to your drive"

But it doesn't work, the Visor shows the following message. What do I miss?

"Traceback (most recent call last):
File "/opt/python/detalib/debugger.py", line 142, in wrap
result = func(event, context)
File "/var/task/_entry.py", line 12, in handler
import main # noqa
File "/var/task/main.py", line 7, in
drive = deta.Drive("photos") # access to your drive
AttributeError: 'Deta' object has no attribute 'Drive'"

environment vars

Hey guys is there a way I can set Environment values in my Deta Micro so that may app can connect to other API and so I don't hard code the API keys into the code?

Bad query results in crash

When I try to query my data using a bad query, the server crashes.

Steps to reproduce:

  1. Create a nodejs app (see StackBlitz)
  2. Try to get the surveys with empty questions using the endpoint http://localhost:3102/surveys/unanswered
  3. Notice the server crashes with error Bad query

Expected behavior: I would expect the server never to crash, but to return a 500 error with the message 'Bad query'.

Error: put() got an unexpected keyword argument 'expire_in'

I see the error when use Base after deploy to deta.
But, it works in my local environment installed deta(v1.1.0) with pip.
Is it possible that version of deta in remote environment is old?

Error

put() got an unexpected keyword argument 'expire_in'

Code

self.deta = Deta()
self.db = self.deta.Base("test_base")
self.db.put({"name": "test"}, "alex", expire_in=5000)

Pinging the Website

Hey there!

I am hosting an API on your service (your service is epic), and I want to track the uptime of the API. Will it be fine if I ping the url using uptimerobot every 10 min as I am tryna host a discord bot on it (not a big one, but a private one for one server only) ? Or is there a way to increase the sleep time of the website as it sleeps as soon as I exit the website...

Thanks!

No entrypoint file found && failed to create new program: No such project

Hello, I just discovered DETA. I was trying to follow the FastAPI documentation. Created an account, installed deta cli, and login successfully. But I failed on the deta new command. I had 2 situation

First situation

I have the folder structure as below

image

When I run deta new, I got No entrypoint file found in '/path/sabiduria-tool'. Please, provide a name or path to create a new micro elsewhere. See "deta new --help".' error.

Second situation

Changed folder structure as below

image

And got this error: Error: failed to create new program: No such project

Here is my main file

from fastapi import FastAPI

from sabiduria_tool_api.core.config import API_PREFIX, APP_NAME, APP_VERSION, IS_DEBUG
from sabiduria_tool_api.core.event_handler import start_app_handler, stop_app_handler
from sabiduria_tool_api.api.routes.router_sabiduria_tool import router

def get_app() -> FastAPI:
    fast_app = FastAPI(title=APP_NAME, version=APP_VERSION, debug=IS_DEBUG)
    fast_app.include_router(router, prefix=API_PREFIX)

    fast_app.add_event_handler("startup", start_app_handler(fast_app))
    fast_app.add_event_handler("shutdown", stop_app_handler(fast_app))

    return fast_app


app = get_app()

I used the app variable as the documentation mentioned. Can anyone tell me what is wrong here, please?

Misnamed method call in Python example

While getting started setting up my account, I noticed a typo in one of the python examples in the user admin portal. After looking through the docs, the method call for creating a new record should be users.insert() instead of users.add(). I searched through the repos under this organization and couldn't locate where this reference comes from to try and make a PR to fix, but thought I should let you know.

image

Cron NOT working

Discussed in https://github.com/orgs/deta/discussions/250

Originally posted by luizfelipevbll June 5, 2022
I am using using deta 1.1.0 with Python with the exactly same code in the docs
Every time I try to run the code I get this error: ImportError: cannot import name 'App' from 'deta'

from deta import App
from fastapi import FastAPI

app = App(FastAPI())

@app.get("/")
def http():
    return "Hello Deta, I am running with HTTP"

@app.lib.cron()
def cron_job(event):
    return "Hello Deta, I am a cron job"

I checked the deta code in deta/init.py
This piece of code in deta lib is not working:

image

The exception raised is No module named 'detalib'

Error running Cron and HTTP code snippets

Hi, I want to know, does this piece of code in the tutorial works? because I got error.
[1]: https://docs.deta.sh/docs/micros/cron#cron-and-http

const { App } = require('deta');
const express = require('express');

const app = App(express());

app.get('/', async(req, res) => {
    res.send('Hello Deta, I am running with HTTP');
});

app.lib.cron(event => {
    return 'Hello Deta, I am a cron job';
});

module.exports = app;

when I run node index.js
I got this error

const app = App(express());
            ^

TypeError: App is not a function
    at Object.<anonymous> (.\index.js:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47

I'm running deta v1.3.0-beta x86_64-windows

Error: invalid character 'H' looking for beginning of value

To produce this bug, just follow the doc in the website.

When I run the command deta run, the response returns error:

Running micro...

Response:
Error: invalid character 'H' looking for beginning of value

index.js file is:

const { app } = require('deta');

app.lib.run((event) => {
  return {
    message: event.json,
  };
});

module.exports = app;

nvm version: 0.34.0
node version: v13.8.0
npm version: 7.0.2

502 Bad Gateway when fetch data from Deta Base

Hello,
I have 3 problematic endpoints showing the 502 Bad Gateway message.

<h1> Bad Gateway </h1>
<p> The micro ran into an error while processing the request. </p>
<p> If you are the owner of the micro, please check your logs. </p>
<p> If the response took around 10s, it might be due to the time out limit.</p>
  1. /all-data
  2. /find-passport/:passp
  3. /find-name/:name

Please check the code below since I feel maybe I've coded it the wrong way causing the error.

Kawanua.

PS:
I have another /find-key/:id endpoint that works perfectly following the tutorial.

Source code

Base data

[
  {
    "key": "key-1",
    "name": "Han Solo",
    "passport": 93284238478,
    "movie": "Star Wars",
  },
  {
    "key": "key-2",
    "name": "Luke Skywalker",
    "passport": 56373942034,
    "movie": "Star Wars",
  },
  {
    "key": "key-3",
    "name": "Doctor Strange",
    "passport": 7123890424,
    "movie": "Star Trek",
  }
]

index.js

Header

const express = require('express');
const { Deta } = require('deta');

const projectKey = 'myPr0j3cTk3y';
const deta = Deta(projectKey);
const dbName = 'dummyDB';
const db = deta.Base(dbName);

const app = express();
app.use(express.json());

// ...

module.exports = app

Dependencies

  "dependencies": {
    "deta": "^1.0.1",
    "express": "^4.17.1"
  }

Problematic endpoints

/all-data

app.get('/all-data', async () => {
    const fetchData = await db.fetch();
    const allData = fetchData.items;
    return allData;
});

/find-passport/:passp

app.get('/find-passport/:passp', async (req, res) => {
    const { passp } = req.params;
    const items = await db.fetch({'passport': passp});
    return items;
});

/find-name/:name

app.get('/find-name/:name', async (req, res) => {
    const { name } = req.params;
    const items = await db.fetch({'name?contains': name});
    return items;
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.